2022-05-21 11:47:41 -04:00
|
|
|
#!/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() {
|
2022-05-21 12:12:09 -04:00
|
|
|
rm file.*
|
2022-05-21 11:47:41 -04:00
|
|
|
rm -r upload
|
|
|
|
}
|