2022-05-21 08:24:49 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
touch emptyfile
|
|
|
|
truncate -s 9KB smallfile
|
|
|
|
truncate -s 10KB normalfile
|
|
|
|
truncate -s 11KB bigfile
|
|
|
|
}
|
|
|
|
|
2022-05-21 09:49:10 -04:00
|
|
|
run_test() {
|
2022-05-21 08:24:49 -04:00
|
|
|
result=$(curl -s -F "file=@emptyfile" localhost:8000)
|
|
|
|
test "invalid file size" = "$result"
|
|
|
|
|
|
|
|
result=$(curl -s -F "file=@bigfile" localhost:8000)
|
|
|
|
test "upload limit exceeded" = "$result"
|
|
|
|
|
|
|
|
result=$(curl -s -F "file=@normalfile" localhost:8000)
|
|
|
|
test "upload limit exceeded" != "$result"
|
|
|
|
|
|
|
|
result=$(curl -s -F "file=@smallfile" localhost:8000)
|
|
|
|
test "upload limit exceeded" != "$result"
|
2022-05-21 09:49:10 -04:00
|
|
|
}
|
2022-05-21 08:24:49 -04:00
|
|
|
|
|
|
|
teardown() {
|
|
|
|
rm emptyfile smallfile normalfile bigfile
|
|
|
|
rm -r upload
|
|
|
|
}
|