All checks were successful
test-backend / test-x86_64 (push) Successful in 23s
42 lines
766 B
Bash
42 lines
766 B
Bash
#!/bin/sh
|
|
|
|
assert_good_status () {
|
|
if [ $? -ne 0 ]; then
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
assert_bad_status () {
|
|
if [ $? -eq 0 ]; then
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
HOST=127.0.0.1
|
|
ARGS="--fail-with-body"
|
|
|
|
curl $ARGS http://$HOST/movies
|
|
assert_good_status
|
|
|
|
curl $ARGS http://$HOST/passes
|
|
assert_good_status
|
|
|
|
curl -X POST $ARGS http://$HOST/apply_for_pass
|
|
assert_bad_status
|
|
|
|
curl -X POST $ARGS http://$HOST/apply_for_pass \
|
|
-H "Content-Type: application/json" \
|
|
--data '{"first": "Hannah",
|
|
"last": "Dirt",
|
|
"email": "hannah.dirt@mail.com",
|
|
"type": 1,
|
|
"price": 50,
|
|
"movie_uuid": "742a2542-2b50-11f0-ae4c-f7bedd5fcc88"}'
|
|
assert_good_status
|
|
|
|
sleep 5
|
|
|
|
curl $ARGS -s http://$HOST/passes
|
|
test "$(curl $ARGS -s http://$HOST/passes | jq '.result.[0]')" != "null"
|
|
assert_good_status
|