test: test successfully

This commit is contained in:
clz 2023-06-12 19:58:59 +08:00
parent 940b641500
commit d68c033ba8

View File

@ -11,6 +11,8 @@ echo
echo "Running end-to-end testing..." echo "Running end-to-end testing..."
echo "Testing GET route '/api/v1'..." echo "Testing GET route '/api/v1'..."
curl $API_URL/api/v1; echo curl $API_URL/api/v1; echo
echo
echo ----------------------------------------------------------------
# Testing '/api/v1/labels'. # Testing '/api/v1/labels'.
echo echo
@ -37,13 +39,20 @@ curl -X DELETE $API_URL/api/v1/labels/3; echo
echo echo
echo "Testing GET route after DELETE '/api/v1/labels/:labelID'..." echo "Testing GET route after DELETE '/api/v1/labels/:labelID'..."
curl $API_URL/api/v1/labels/3; echo curl $API_URL/api/v1/labels/3; echo
echo
echo ----------------------------------------------------------------
# Test '/api/v1/bills' # Test '/api/v1/bills'
echo echo
echo "Using 'year' with value of 2023, 'month' with value of 5, and 'day' with value of 30 "
echo "Testing GET route '/api/v1/bills'..." echo "Testing GET route '/api/v1/bills'..."
curl $API_URL/api/v1/bills; echo curl $API_URL/api/v1/bills; echo
echo echo
echo "Testing POST route '/api/v1/bills'..."
curl -X POST -H 'Content-Type: application/json' -d '{"id": 10, "year": 2023,"month":6, "day": 10, "money": 200, "label": "shopping"}' $API_URL/api/v1/bills; echo
# Test '/api/v1/bills/:year?/:month?/:day?'
echo
echo "Using 'year' with value of 2023, 'month' with value of 5, and 'day' with value of 30 "
echo "Testing GET route '/api/v1/bills/:year'..." echo "Testing GET route '/api/v1/bills/:year'..."
curl $API_URL/api/v1/bills/2023; echo curl $API_URL/api/v1/bills/2023; echo
echo echo
@ -52,11 +61,29 @@ curl $API_URL/api/v1/bills/2023/5; echo
echo echo
echo "Testing GET route '/api/v1/bills/:year/:month/:day'..." echo "Testing GET route '/api/v1/bills/:year/:month/:day'..."
curl $API_URL/api/v1/bills/2023/5/30; echo curl $API_URL/api/v1/bills/2023/5/30; echo
# Test '/api/v1/bills/id/:billID'
echo echo
echo "Testing POST route '/api/v1/bills" echo "Using 'billID' with value of 10 (the one created beforehand)."
curl -X POST -H 'Content-Type: application/json' -d '{"year": 2023,"month":6, "day": 10, "money": 200, "label": "shopping"}' $API_URL/api/v1/bills; echo echo "Testing GET route '/api/v1/bills/id/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
# Test '/api/v1/bills/:billID'
echo
echo "Using 'billID' with value of 10 (the one created beforehand)."
echo "Testing PUT route '/api/v1/bills/:billID'..."
curl -X PUT -H 'Content-Type: application/json' -d '{"year": 2023,"month":6, "day": 10, "money": 21.2, "label": "transport"}' $API_URL/api/v1/bills/10; echo
echo
echo "Testing GET route after PUT '/api/v1/bills/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
echo
echo "Test DELETE route '/api/v1/bills/:billID'..."
curl -X DELETE $API_URL/api/v1/bills/10; echo
echo
echo "Testing GET route after DELETE '/api/v1/bills/id/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
echo
echo ----------------------------------------------------------------
## Testing '/api/v1/auth/login'. ## Testing '/api/v1/auth/login'.
#echo #echo