rustypaste-pretty/fixtures
TheTechRobo 37cb4d3fcb
feat(server): add landing page (#26)
* feat(server): add landing page

Fixes orhun/rustypaste#13

* feat(server): allow using {REPOSITORY} in landing page

* fix(server): Get rid of unused import, add line about expiration

* chore(fmt): cargo fmt

* fix(tests): inject app data for fixing index test

* feat(server): redirect to GitHub repository if landing page is not specified

* test(fixtures): add fixture test for landing page

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2022-10-03 21:27:35 +00:00
..
test-duplicate-file-upload
test-expiring-file-upload
test-file-upload
test-oneshot-upload
test-path-traversal
test-random-url test(fixtures): add fixture test for random URL 2022-05-21 19:31:43 +03:00
test-remote-file-upload
test-server-auth
test-server-auto-deletion
test-server-default-extension test(fixtures): add fixture test for default extension 2022-05-21 19:23:59 +03:00
test-server-landing-page feat(server): add landing page (#26) 2022-10-03 21:27:35 +00: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
test-url-upload
.env
README.md
test-fixtures.sh

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