mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
test(fixtures): add fixture test for default extension
This commit is contained in:
parent
5cdca1d9aa
commit
a98f0ae22e
2 changed files with 31 additions and 0 deletions
9
fixtures/test-server-default-extension/config.toml
Normal file
9
fixtures/test-server-default-extension/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[server]
|
||||||
|
address="127.0.0.1:8000"
|
||||||
|
max_content_length="10MB"
|
||||||
|
upload_path="./upload"
|
||||||
|
|
||||||
|
[paste]
|
||||||
|
random_url = { enabled = false, type = "petname", words = 2, separator = "-" }
|
||||||
|
default_extension = "bin"
|
||||||
|
duplicate_files = false
|
22
fixtures/test-server-default-extension/test.sh
Executable file
22
fixtures/test-server-default-extension/test.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
content="test data"
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
echo "$content" > file
|
||||||
|
echo "<html></html>" > file.html
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test() {
|
||||||
|
file_url=$(curl -s -F "file=@file" localhost:8000)
|
||||||
|
test "$file_url" = "http://localhost:8000/file.bin"
|
||||||
|
test "$content" = "$(cat upload/file.bin)"
|
||||||
|
test "$content" = "$(curl -s $file_url)"
|
||||||
|
|
||||||
|
test "http://localhost:8000/file.html" = "$(curl -s -F file=@file.html localhost:8000)"
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
rm file*
|
||||||
|
rm -r upload
|
||||||
|
}
|
Loading…
Reference in a new issue