sdlc-project/tests/backend.sh
hasslesstech 0e8569593c
Some checks failed
test-backend / test-x86_64 (push) Failing after 2s
improve testing workflow
2025-05-25 21:18:02 +03:00

38 lines
646 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
curl http://$HOST/movies
assert_good_status
curl http://$HOST/passes
assert_good_status
curl -X POST http://$HOST/apply_for_pass
assert_bad_status
curl -X POST 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
curl http://$HOST/passes | jq '.result.[0]'
assert_good_status