mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 11:59:48 -05:00
23 lines
459 B
Bash
Executable file
23 lines
459 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
auth_token="rustypasteisawesome"
|
|
content="topsecret"
|
|
|
|
setup() {
|
|
echo "$content" > file
|
|
}
|
|
|
|
run_test() {
|
|
result=$(curl -s -F "file=@file" localhost:8000)
|
|
test "unauthorized" = "$result"
|
|
|
|
result=$(curl -s -F "file=@file" -H "Authorization: $auth_token" localhost:8000)
|
|
test "unauthorized" != "$result"
|
|
test "$content" = "$(cat upload/file.txt)"
|
|
test "$content" = "$(curl -s $result)"
|
|
}
|
|
|
|
teardown() {
|
|
rm file
|
|
rm -r upload
|
|
}
|