mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
fix(fixtures): exit the run_test function on error
This commit is contained in:
parent
685d9607c8
commit
c60090d461
10 changed files with 20 additions and 20 deletions
|
@ -29,9 +29,9 @@ setup() {
|
|||
# preparation
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
# assertions
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
# cleanup
|
||||
|
|
|
@ -9,7 +9,7 @@ setup() {
|
|||
date +%s > unique_file2
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
first_file_url=$(curl -s -F "file=@file" localhost:8000)
|
||||
test "$duplicate_content" = "$(cat upload/file.txt)"
|
||||
|
||||
|
@ -22,7 +22,7 @@ run_test() {
|
|||
first_file_url=$(curl -s -F "file=@unique_file1" localhost:8000)
|
||||
second_file_url=$(curl -s -F "file=@unique_file2" localhost:8000)
|
||||
test "$first_file_url" != "$second_file_url"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file unique_file1 unique_file2
|
||||
|
|
|
@ -6,14 +6,14 @@ setup() {
|
|||
echo "$content" > file
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
file_url=$(curl -s -F "file=@file" -H "expire:1s" localhost:8000)
|
||||
test "$content" = "$(cat upload/file.txt.*)"
|
||||
sleep 2s
|
||||
|
||||
result="$(curl -s $file_url)"
|
||||
test "file is not found or expired :(" = "$result"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file
|
||||
|
|
|
@ -6,12 +6,12 @@ setup() {
|
|||
echo "$content" > file
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
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)"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file
|
||||
|
|
|
@ -6,14 +6,14 @@ setup() {
|
|||
echo "$content" > file
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
file_url=$(curl -s -F "oneshot=@file" localhost:8000)
|
||||
test "$content" = $(curl -s "$file_url")
|
||||
test "$content" = "$(cat upload/oneshot/file.txt.*)"
|
||||
|
||||
result="$(curl -s $file_url)"
|
||||
test "file is not found or expired :(" = "$result"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file
|
||||
|
|
|
@ -6,7 +6,7 @@ setup() {
|
|||
echo "$content" > file
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
result=$(curl -s --path-as-is localhost:8000/.)
|
||||
test "file is not found or expired :(" = "$result"
|
||||
|
||||
|
@ -15,7 +15,7 @@ run_test() {
|
|||
|
||||
result=$(curl -s -X POST -F "file=@file;filename=../." localhost:8000)
|
||||
test "$content" = "$(cat upload/file.txt)"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file
|
||||
|
|
|
@ -6,12 +6,12 @@ setup() {
|
|||
:;
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
file_url=$(curl -s -F "remote=$url" localhost:8000)
|
||||
curl -s "$file_url" -o uploaded_file > /dev/null
|
||||
curl -s "$url" -o remote_file > /dev/null
|
||||
test "$(sha256sum uploaded_file | awk '{print $1}')" = "$(sha256sum remote_file | awk '{print $1}')"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm uploaded_file remote_file
|
||||
|
|
|
@ -7,7 +7,7 @@ setup() {
|
|||
echo "$content" > file
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
result=$(curl -s -F "file=@file" localhost:8000)
|
||||
test "unauthorized" = "$result"
|
||||
|
||||
|
@ -15,7 +15,7 @@ run_test() {
|
|||
test "unauthorized" != "$result"
|
||||
test "$content" = "$(cat upload/file.txt)"
|
||||
test "$content" = "$(curl -s $result)"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm file
|
||||
|
|
|
@ -7,7 +7,7 @@ setup() {
|
|||
truncate -s 11KB bigfile
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
result=$(curl -s -F "file=@emptyfile" localhost:8000)
|
||||
test "invalid file size" = "$result"
|
||||
|
||||
|
@ -19,7 +19,7 @@ run_test() {
|
|||
|
||||
result=$(curl -s -F "file=@smallfile" localhost:8000)
|
||||
test "upload limit exceeded" != "$result"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm emptyfile smallfile normalfile bigfile
|
||||
|
|
|
@ -6,13 +6,13 @@ setup() {
|
|||
:;
|
||||
}
|
||||
|
||||
run_test() {
|
||||
run_test() ( set -e;
|
||||
curl -s -F "url=$url" localhost:8000 > /dev/null
|
||||
test "$url" = "$(cat upload/url/url)"
|
||||
|
||||
result=$(curl -s -F "url=invalidurl" localhost:8000)
|
||||
test "relative URL without a base" = "$result"
|
||||
}
|
||||
)
|
||||
|
||||
teardown() {
|
||||
rm -r upload
|
||||
|
|
Loading…
Reference in a new issue