feat: test cases
This commit is contained in:
parent
c82a369d65
commit
63bf768535
|
@ -3,7 +3,7 @@
|
|||
API_URL=http://localhost:8080
|
||||
|
||||
# Introduction to the script.
|
||||
echo "Welcome to 'docker-mariadb-clean-arch' application!"
|
||||
echo "Welcome to 'bill-server' application!"
|
||||
echo "Before running the end-to-end tests, please ensure that you have run 'make start'!"; echo
|
||||
|
||||
# Testing '/api/v1'.
|
||||
|
@ -12,73 +12,73 @@ echo "Running end-to-end testing..."
|
|||
echo "Testing GET route '/api/v1'..."
|
||||
curl $API_URL/api/v1; echo
|
||||
|
||||
# Testing '/api/v1/users'.
|
||||
# Testing '/api/v1/labels'.
|
||||
echo
|
||||
echo "Testing GET route '/api/v1/users'..."
|
||||
curl $API_URL/api/v1/users; echo
|
||||
echo "Testing GET route '/api/v1/labels'..."
|
||||
curl $API_URL/api/v1/labels; echo
|
||||
echo
|
||||
echo "Testing POST route '/api/v1/users'..."
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"name":"Lucy Heartfilia","address":"Shinhotaka, Japan"}' $API_URL/api/v1/users; echo
|
||||
echo "Testing POST route '/api/v1/labels'..."
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"name":"Lucy Heartfilia","type":"income"}' $API_URL/api/v1/labels; echo
|
||||
|
||||
# Testing '/api/v1/users/:userID'.
|
||||
# Testing '/api/v1/labels/:labelID'.
|
||||
echo
|
||||
echo "Using 'userID' with value of 11 (the one created beforehand)."
|
||||
echo "Testing GET route '/api/v1/users/:userID'..."
|
||||
curl $API_URL/api/v1/users/11; echo
|
||||
echo "Using 'labelID' with value of 3 (the one created beforehand)."
|
||||
echo "Testing GET route '/api/v1/labels/:labelID'..."
|
||||
curl $API_URL/api/v1/labels/3; echo
|
||||
echo
|
||||
echo "Testing PUT route '/api/v1/users/:userID'..."
|
||||
curl -X PUT -H 'Content-Type: application/json' -d '{"name":"Mirajane Strauss","address":"Osaka, Japan"}' $API_URL/api/v1/users/11; echo
|
||||
echo "Testing PUT route '/api/v1/labels/:labelID'..."
|
||||
curl -X PUT -H 'Content-Type: application/json' -d '{"name":"Mirajane Strauss","type":"consume"}' $API_URL/api/v1/labels/3; echo
|
||||
echo
|
||||
echo "Testing GET route after PUT '/api/v1/users/:userID'..."
|
||||
curl $API_URL/api/v1/users/11; echo
|
||||
echo "Testing GET route after PUT '/api/v1/labels/:labelID'..."
|
||||
curl $API_URL/api/v1/labels/3; echo
|
||||
echo
|
||||
echo "Testing DELETE route '/api/v1/users/:userID'..."
|
||||
curl -X DELETE $API_URL/api/v1/users/11; echo
|
||||
echo "Testing DELETE route '/api/v1/labels/:labelID'..."
|
||||
curl -X DELETE $API_URL/api/v1/labels/3; echo
|
||||
echo
|
||||
echo "Testing GET route after DELETE '/api/v1/users/:userID'..."
|
||||
curl $API_URL/api/v1/users/11; echo
|
||||
echo "Testing GET route after DELETE '/api/v1/labels/:labelID'..."
|
||||
curl $API_URL/api/v1/labels/3; echo
|
||||
|
||||
# Testing '/api/v1/auth/login'.
|
||||
echo
|
||||
echo "Testing POST route '/api/v1/auth/login'..."
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"username":"fiber","password":"fiber"}' -c cookie.txt $API_URL/api/v1/auth/login; echo
|
||||
|
||||
# Testing '/api/v1/auth/private'.
|
||||
echo
|
||||
echo "Testing GET route '/api/v1/auth/private'..."
|
||||
curl -b cookie.txt $API_URL/api/v1/auth/private; echo
|
||||
|
||||
# Testing '/api/v1/cities'.
|
||||
echo
|
||||
echo "Testing GET route '/api/v1/cities'..."
|
||||
curl -b cookie.txt $API_URL/api/v1/cities; echo
|
||||
echo
|
||||
echo "Testing POST route '/api/v1/cities'..."
|
||||
curl -b cookie.txt -X POST -H 'Content-Type: application/json' -d '{"name":"Kyoto"}' $API_URL/api/v1/cities; echo
|
||||
|
||||
# Testing '/api/v1/cities/:cityID'.
|
||||
echo
|
||||
echo "Using 'cityID' with value of 6 (the one created beforehand)."
|
||||
echo "Testing GET route '/api/v1/cities/:cityID'..."
|
||||
curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
echo
|
||||
echo "Testing PUT route '/api/v1/cities/:cityID'..."
|
||||
curl -b cookie.txt -X PUT -H 'Content-Type: application/json' -d '{"name":"Osaka"}' $API_URL/api/v1/cities/6; echo
|
||||
echo
|
||||
echo "Testing GET route after PUT '/api/v1/cities/:cityID'..."
|
||||
curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
echo
|
||||
echo "Testing DELETE route '/api/v1/cities/:cityID'..."
|
||||
curl -b cookie.txt -X DELETE $API_URL/api/v1/cities/6; echo
|
||||
echo
|
||||
echo "Testing GET route after DELETE '/api/v1/cities/:cityID'..."
|
||||
curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
|
||||
# Testing '/api/v1/auth/logout'.
|
||||
echo
|
||||
echo "Testing POST route '/api/v1/auth/logout'..."
|
||||
curl -X POST $API_URL/api/v1/auth/logout; echo
|
||||
|
||||
# Finish end-to-end testing.
|
||||
rm cookie.txt
|
||||
echo "Finished testing the application!"
|
||||
## Testing '/api/v1/auth/login'.
|
||||
#echo
|
||||
#echo "Testing POST route '/api/v1/auth/login'..."
|
||||
#curl -X POST -H 'Content-Type: application/json' -d '{"username":"fiber","password":"fiber"}' -c cookie.txt $API_URL/api/v1/auth/login; echo
|
||||
#
|
||||
## Testing '/api/v1/auth/private'.
|
||||
#echo
|
||||
#echo "Testing GET route '/api/v1/auth/private'..."
|
||||
#curl -b cookie.txt $API_URL/api/v1/auth/private; echo
|
||||
#
|
||||
## Testing '/api/v1/cities'.
|
||||
#echo
|
||||
#echo "Testing GET route '/api/v1/cities'..."
|
||||
#curl -b cookie.txt $API_URL/api/v1/cities; echo
|
||||
#echo
|
||||
#echo "Testing POST route '/api/v1/cities'..."
|
||||
#curl -b cookie.txt -X POST -H 'Content-Type: application/json' -d '{"name":"Kyoto"}' $API_URL/api/v1/cities; echo
|
||||
#
|
||||
## Testing '/api/v1/cities/:cityID'.
|
||||
#echo
|
||||
#echo "Using 'cityID' with value of 6 (the one created beforehand)."
|
||||
#echo "Testing GET route '/api/v1/cities/:cityID'..."
|
||||
#curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
#echo
|
||||
#echo "Testing PUT route '/api/v1/cities/:cityID'..."
|
||||
#curl -b cookie.txt -X PUT -H 'Content-Type: application/json' -d '{"name":"Osaka"}' $API_URL/api/v1/cities/6; echo
|
||||
#echo
|
||||
#echo "Testing GET route after PUT '/api/v1/cities/:cityID'..."
|
||||
#curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
#echo
|
||||
#echo "Testing DELETE route '/api/v1/cities/:cityID'..."
|
||||
#curl -b cookie.txt -X DELETE $API_URL/api/v1/cities/6; echo
|
||||
#echo
|
||||
#echo "Testing GET route after DELETE '/api/v1/cities/:cityID'..."
|
||||
#curl -b cookie.txt $API_URL/api/v1/cities/6; echo
|
||||
#
|
||||
## Testing '/api/v1/auth/logout'.
|
||||
#echo
|
||||
#echo "Testing POST route '/api/v1/auth/logout'..."
|
||||
#curl -X POST $API_URL/api/v1/auth/logout; echo
|
||||
#
|
||||
## Finish end-to-end testing.
|
||||
#rm cookie.txt
|
||||
#echo "Finished testing the application!"
|
||||
|
|
Loading…
Reference in New Issue
Block a user