4774de6652
* refactor(server): use more specific http status codes * fix: clippy error - oops missed that one * test(fixtures): add check for status code |
||
---|---|---|
.. | ||
test-duplicate-file-upload | ||
test-expiring-file-upload | ||
test-file-delete | ||
test-file-upload | ||
test-file-upload-override-filename | ||
test-file-upload-same-filename | ||
test-filename-replace | ||
test-list-files | ||
test-list-files-not-exposed | ||
test-multiple-files-upload-not-found | ||
test-oneshot-upload | ||
test-oneshot-url | ||
test-path-traversal | ||
test-random-suffix | ||
test-random-url | ||
test-remote-file-upload | ||
test-server-auth | ||
test-server-auth-multiple-tokens | ||
test-server-auth-tokens-unset | ||
test-server-auto-deletion | ||
test-server-default-extension | ||
test-server-delete-tokens-unset | ||
test-server-landing-page | ||
test-server-landing-page-file | ||
test-server-mime-blacklist | ||
test-server-mime-override | ||
test-server-payload-limit | ||
test-url-encode | ||
test-url-upload | ||
test-version-not-exposed | ||
.env | ||
README.md | ||
test-fixtures.sh |
README.md
Fixtures
This directory contains the test fixtures and a simple testing framework for rustypaste
.
Running fixtures
- Build the project in debug mode:
cargo build
- 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 therustypaste
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