rustypaste/fixtures
Helmut K. C. Tessarek db971e6434
feat(server): allow to override filename when using random_url (#233)
* feat(server): allow to override filename when using random_url

* docs(README): remove line from features

* refactor(header): make const private
2024-02-12 13:06:12 +01:00
..
test-duplicate-file-upload feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-expiring-file-upload test(fixtures): support `fixtures` on `macOS` (#200) 2023-12-10 16:04:28 +01:00
test-file-delete refactor(server): change response to 'file deleted' (#137) 2023-09-04 11:09:29 +02:00
test-file-upload feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-file-upload-override-filename feat(server): allow to override filename when using random_url (#233) 2024-02-12 13:06:12 +01:00
test-filename-replace feat(server): support handling spaces in filenames (#107) 2023-08-26 14:35:13 +02:00
test-list-files test(fixtures): support `fixtures` on `macOS` (#200) 2023-12-10 16:04:28 +01:00
test-list-files-not-exposed refactor(server)!: cleanup authorization boilerplate (#199) 2023-12-12 19:21:29 +01:00
test-multiple-files-upload-not-found fix(server): return the correct file on multiple files with same name (#234) 2024-02-09 21:38:33 +01:00
test-oneshot-upload feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-oneshot-url feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-path-traversal feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-random-suffix feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-random-url feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-remote-file-upload feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-auth feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-auth-multiple-tokens feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-auth-tokens-unset refactor(server)!: cleanup authorization boilerplate (#199) 2023-12-12 19:21:29 +01:00
test-server-auto-deletion test(fixtures): support `fixtures` on `macOS` (#200) 2023-12-10 16:04:28 +01:00
test-server-default-extension feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-delete-tokens-unset refactor(server)!: cleanup authorization boilerplate (#199) 2023-12-12 19:21:29 +01:00
test-server-landing-page feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-landing-page-file feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-mime-blacklist feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-mime-override feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-server-payload-limit test(fixtures): support `fixtures` on `macOS` (#200) 2023-12-10 16:04:28 +01:00
test-url-encode feat(server): support handling spaces in filenames (#107) 2023-08-26 14:35:13 +02:00
test-url-upload feat(server): improve random_url config handling (#122) 2023-08-20 20:32:41 +02:00
test-version-not-exposed refactor(server)!: cleanup authorization boilerplate (#199) 2023-12-12 19:21:29 +01:00
.env test(fixtures): add a test framework along with test fixtures 2022-05-21 15:27:38 +03:00
README.md chore(fixtures): run fixtures on `macos` & `ubuntu` (#201) 2023-12-11 19:16:25 +01:00
test-fixtures.sh refactor(fixtures): merge test steps in a single subshell 2022-05-21 17:52:47 +03:00

README.md

Fixtures

This directory contains the test fixtures and a simple testing framework for rustypaste.

Running fixtures

  1. Build the project in debug mode: cargo build
  2. Execute the runner script in this directory: ./test-fixtures.sh

On macOS you need to have coreutils installed to run the script. The simplest way is to install it via Homebrew: brew install coreutils

Adding new fixtures

Create an appropriately named directory for the test fixture you want to add. e.g. test-file-upload

Each fixture directory should contain the following files:

test-file-upload/
├── config.toml
└── test.sh
  • config.toml: Contains the rustypaste configuration. See the default configuration.
  • test.sh: Contains the helper functions for testing. The file format is the following:
#!/usr/bin/env bash

setup() {
  # preparation
}

run_test() {
  # assertions
}

teardown() {
  # cleanup
}

These functions are executed in the order defined above.

See the test-file-upload fixture for an example.

Debugging

Set the DEBUG environment variable to true while executing the runner script:

$ DEBUG=true ./test-fixtures.sh