test(fixtures): add check for status code

This commit is contained in:
Helmut K. C. Tessarek 2024-03-08 19:05:48 -05:00
parent 191fa48b21
commit 075fc84091
No known key found for this signature in database
GPG Key ID: BE0985349D44DD00
2 changed files with 3 additions and 0 deletions

View File

@ -13,6 +13,8 @@ run_test() {
test "$content" = "$(curl -s $file_url)"
file_url=$(curl -s -F "file=@file" -H "filename:fn_from_header.txt" localhost:8000)
test "$file_url" = "file already exists"
status_code=$(curl -s -F "file=@file" -H "filename:fn_from_header.txt" -w "%{response_code}" -o /dev/null localhost:8000)
test "$status_code" = "409"
}
teardown() {

View File

@ -11,6 +11,7 @@ setup() {
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)"
test "415" = "$(curl -s -F "file=@file.xml" -w "%{response_code}" -o /dev/null localhost:8000)"
file_url=$(curl -s -F "file=@file.txt" localhost:8000)
test "$content" = "$(curl -s $file_url)"
}