mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 11:59:48 -05:00
test(fixtures): add fixture test for MIME blacklist
This commit is contained in:
parent
d262a3d297
commit
c06fff92ac
2 changed files with 34 additions and 0 deletions
13
fixtures/test-server-mime-blacklist/config.toml
Normal file
13
fixtures/test-server-mime-blacklist/config.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[server]
|
||||
address="127.0.0.1:8000"
|
||||
max_content_length="10MB"
|
||||
upload_path="./upload"
|
||||
|
||||
[paste]
|
||||
random_url = { enabled = true, type = "petname", words = 2, separator = "-" }
|
||||
default_extension = "txt"
|
||||
duplicate_files = true
|
||||
mime_blacklist = [
|
||||
"text/html",
|
||||
"text/xml",
|
||||
]
|
21
fixtures/test-server-mime-blacklist/test.sh
Executable file
21
fixtures/test-server-mime-blacklist/test.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
content="test data"
|
||||
|
||||
setup() {
|
||||
echo "<html></html>" > file.html
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>' > file.xml
|
||||
echo "$content" > file.txt
|
||||
}
|
||||
|
||||
run_test() {
|
||||
test "this file type is not permitted" = "$(curl -s -F "file=@file.html" localhost:8000)"
|
||||
test "this file type is not permitted" = "$(curl -s -F "file=@file.xml" localhost:8000)"
|
||||
file_url=$(curl -s -F "file=@file.txt" localhost:8000)
|
||||
test "$content" = "$(curl -s $file_url)"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm file*
|
||||
rm -r upload
|
||||
}
|
Loading…
Reference in a new issue