rustypaste-pretty/fixtures/test-server-mime-override/test.sh
2022-05-21 19:12:09 +03:00

26 lines
672 B
Bash
Executable file

#!/usr/bin/env bash
content="test"
setup() {
for ext in "txt" "tar" "png"; do
echo "$content" > "file.$ext"
done
}
run_test() {
file_url=$(curl -s -F "file=@file.txt" localhost:8000)
test "application/x-shockwave-flash" = "$(curl -s --write-out %{content_type} $file_url | tail -n 1)"
file_url=$(curl -s -F "file=@file.tar" localhost:8000)
test "image/gif" = "$(curl -s --write-out %{content_type} $file_url | tail -n 1)"
file_url=$(curl -s -F "file=@file.png" localhost:8000)
test "image/png" = "$(curl -s --write-out %{content_type} $file_url | tail -n 1)"
test "$content" = "$(curl -s $file_url)"
}
teardown() {
rm file.*
rm -r upload
}