rustypaste-pretty/fixtures
2022-05-21 19:12:09 +03:00
..
test-duplicate-file-upload fix(fixtures): enable random URLs for duplicate file fixture 2022-05-21 17:52:14 +03:00
test-expiring-file-upload refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-file-upload refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-oneshot-upload refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-path-traversal refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-remote-file-upload refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-server-auth refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-server-auto-deletion test(fixtures): add fixture test for auto deletion 2022-05-21 18:23:21 +03:00
test-server-mime-blacklist test(fixtures): add fixture test for MIME override 2022-05-21 19:12:09 +03:00
test-server-mime-override test(fixtures): add fixture test for MIME override 2022-05-21 19:12:09 +03:00
test-server-payload-limit refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-url-upload refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
.env test(fixtures): add a test framework along with test fixtures 2022-05-21 15:27:38 +03:00
README.md refactor(fixtures): use subshell for running fixture methods 2022-05-21 16:51:06 +03:00
test-fixtures.sh refactor(fixtures): merge test steps in a single subshell 2022-05-21 17:52:47 +03:00

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

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