2022-05-21 12:24:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
content="test data"
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
echo "$content" > file
|
2023-06-30 22:11:16 +00:00
|
|
|
echo "$content" > .file
|
2022-05-21 12:24:49 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 13:49:10 +00:00
|
|
|
run_test() {
|
2022-05-21 12:24:49 +00:00
|
|
|
file_url=$(curl -s -F "file=@file" localhost:8000)
|
|
|
|
test "$file_url" = "http://localhost:8000/file.txt"
|
|
|
|
test "$content" = "$(cat upload/file.txt)"
|
|
|
|
test "$content" = "$(curl -s $file_url)"
|
2023-06-30 22:11:16 +00:00
|
|
|
file_url2=$(curl -s -F "file=@.file" localhost:8000)
|
|
|
|
test "$file_url2" = "http://localhost:8000/.file.txt"
|
2022-05-21 13:49:10 +00:00
|
|
|
}
|
2022-05-21 12:24:49 +00:00
|
|
|
|
|
|
|
teardown() {
|
2023-06-30 22:11:16 +00:00
|
|
|
rm file .file
|
2022-05-21 12:24:49 +00:00
|
|
|
rm -r upload
|
|
|
|
}
|