NickPerlich / Bettermo

1 stars 1 forks source link

Test results Ivan Nghi #16

Open ivannghi opened 11 months ago

ivannghi commented 11 months ago

Testing Background Jacob is the dungeon master for a DnD group with his friends. He expects to purchase equipment to improve the experience for his friends, and his friends agree they will pay him back. Jacob wants to make a group with our service to log his purchases.

User Goal

Jacob initiates the process of creating a group with our service.

API Calls

Starts by calling POST /users with his name to get a new user with ID 22. then Jacob calls POST /groups with a group name to get a new group with ID 13. then Jacob asks all his friends to create accounts. They each call POST /users to get new users with IDs 23 and 24. then Jacob calls POST /groups/13/users/{user_id} for the following user ids: 22, 23, 24. Now, Jacob can use this group with our service to post purchases as required.

Testing results

curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jacob", "email": "Jacob1@gmail.com", "phone": "1234567890" }' result: {"new_user_id":22}

  1. curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Tim", "email": "Tim1@gmail.com", "phone": "1234567890" }'

result: {"new_user_id":23}

  1. curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Andy", "email": "Andy1@gmail.com", "phone": "1234567890" }' result: {"new_user_id":24}
  2. curl -X 'POST' \ 'https://better-mo.onrender.com/groups/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jacob group", "description": "friends" }' result: {"new_group_id":13}
  3. curl --location --request POST 'better-mo.onrender.com/groups/13/addUser/22' result: {"id":29}
  4. curl --location --request POST 'better-mo.onrender.com/groups/13/addUser/23' result: {"id":30}
  5. curl --location --request POST 'better-mo.onrender.com/groups/13/addUser/24' result: {"id":31}

Background Bart is a 16-year-old who has to make dinner for his two brothers (Phil and Tim) and his parents (Lisa and Chris) once a week. He is a part of a group with his family where Chris is the owner. He just went to the store and got the ingredients to make a scrumptious lasagna. Fortunately, he remembered to keep the receipt and is now sitting at his kitchen counter needing to log a purchase with his family. Unfortunately, he overdrafted his bank account and is going to ask his brothers to resolve their balances, which they will need to agree to.

User Goal Bart wants to log a purchase with his family.

API Calls Family Group Id: 3 Bart User Id: 4, Phil User Id: 5, Tim User Id: 6, Chris User Id: 2 Bart calls POST /groups/3/user/4/purchases with the total value of the receipt passed in as the body. then Bart calls GET /users/4/balances/5 to get the Balance between him and Phil then Bart sees that he is still in the red so he does not resolve the transaction. then Bart calls GET /users/4/balances/6 to get the Balance between him and Tim then Bart sees that is is likewise still in the red with Tim. Bart is sad. then Bat calls GET /users/4/balances/2 to get the Balance between him and Chris and sees that there is a positive balance! He then asks to resolve the balance then Bart calls POST users/4/balances/2 with an amount of 18.23 to resolve the balance and Bart waits for Christ to pay.

Testing results

  1. -X POST --location 'http://better-mo.onrender.com/groups/3/user/4/purchases' --header 'Content-Type: application/json' --data-raw '{ "description": "Ingredients from the store", "price": 65.98 }' result: "200 OK"

  2. curl -X GET --location 'http://better-mo.onrender.com/users/4/balances/5' --header 'Content-Type: application/json'' result: {"Balance": -3.85}

  3. curl --location 'http://better-mo.onrender.com/users/4/balances/6' --header 'Content-Type: application/json'' result: {"Balance": -15.00}

  4. curl --location 'http://better-mo.onrender.com/users/4/balances/2' --header 'Content-Type: application/json'' result: {"Balance": 18.23}

  5. curl -X POST --location 'http://better-mo.onrender.com/users/3/balance/2' --header 'Content-Type: application/json' --data-raw '{ "amount": 18.23 }' result: "200 OK"

Background Jimmy and Jerry are roommates and Jimmy wants to pay back Jerry for dinner. Thus, Jimmy attempts to settle his debt with Jerry so that when Jerry checks who has attempted to settle debt he can accept or decline the settlement.

User Goal Jimmy wants to attempt to settle his debt to Jerry.

API Calls Roommate Group Id: 4 Jimmy User Id: 1, Jerry User Id: 2 Jimmy calls GET /users/2/balances/1 to get the Balance between him and Jerry. Jimmy pays Jerry on Venmo (sponsor us please). Jimmy calls POST /users/2/balances/1 to make an attempt to settle his debt with Jerry.

Testing results

  1. curl --location 'http://better-mo.onrender.com/users' --header 'Content-Type: application/json' --data-raw '{ "name": "Jimmy", "email": "jimmy@gmail.com", "phone": "11111" }' result: {"new_user_id":10}

  2. curl --location 'http://better-mo.onrender.com/users' --header 'Content-Type: application/json' --data-raw '{ "name": "Jerry", "email": "jerry@gmail.com", "phone": "222222" }' result: {"new_user_id":11}

  3. curl --location 'http://better-mo.onrender.com/groups' --header 'Content-Type: application/json' --data '{ "name": "JimmyJerryBFFS", "description": "Friends 4ever <3" }' result: {"new_group_id":3}

  4. curl --location --request POST 'better-mo.onrender.com/groups/3/addUser/10' result: {"id":5}

  5. curl --location --request POST 'better-mo.onrender.com/groups/3/addUser/11' result: {"id":6}

  6. curl -X POST --location 'http://better-mo.onrender.com/groups/3/user/10/purchases' --header 'Content-Type: application/json' --data-raw '{ "description": "Dinner Jimmy Jerry", "price": 28.00 }' result: "200 OK"

  7. curl --location 'http://better-mo.onrender.com/users/4/balances/2' --header 'Content-Type: application/json'' result: {"Balance": -14.00}

  8. curl -X POST --location 'http://better-mo.onrender.com/users/10/balance/11' --header 'Content-Type: application/json' --data-raw '{ "amount": 14.00 }' result: "200 OK"

New test 1: Ivan and Ian went to the store to get some snacks for their friends and planned to split the costs. He decides to use the service to fairly split the 20 dollar shopping trip. First calling /users to create a user for Ivan, Ian, and their friend Jin. Then calling /groups/ followed by /groups/{group_id}/users/ for each friend to be added to the group. Then the payment is posted and split using a call to /groups/{group_id}/purchases/{user_id}.

User Goal: Split costs on snacks.

API Calls: New Users, Group, AddUser, Post Purchase for split.

1.curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Ivan", "email": "ivan@gmail.com", "phone": "1234567890" }' {"new_user_id": 31} 2. curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Ian", "email": "ian@gmail.com", "phone": "2234567890" }' { "new_user_id": 32} 3. curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jin", "email": "Jin@gmail.com", "phone": "3234567890" }' { "new_user_id": 33}

  1. curl -X 'POST' \ 'https://better-mo.onrender.com/groups/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Ivan'\''s group", "description": "friends" }' { "new_group_id": 17 }

  2. curl --location --request POST 'better-mo.onrender.com/groups/17/addUser/31' result: {"id":29}
  3. curl --location --request POST 'better-mo.onrender.com/groups/17/addUser/32' result: {"id":30}
  4. curl --location --request POST 'better-mo.onrender.com/groups/17/addUser/33' result: {"id":31}
  5. curl -X 'POST' \ 'https://better-mo.onrender.com/groups/17/users/31/purchases' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "description": "snacks", "price": 20 }' "OK"

New Test 2: Ian owes Ivan Money and they are already users of the service. They check the balances and the Ian pays Ivan what he owes. Calling /users/{user_id}/balances/{other_user_id} to get balance and /users/{uid1}/pay/{uid2} to pay

User goal: check balance and pay

API calls: Check balance, pay

1.curl -X 'GET' \ 'https://better-mo.onrender.com/users/31/balances/32' \ -H 'accept: application/json' { "Balance": -10 } 2.curl -X 'POST' \ 'https://better-mo.onrender.com/users/32/pay/31' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "amount": 10, "description": "snacks" }' { "Amount paid": 10 } 3.curl -X 'GET' \ 'https://better-mo.onrender.com/users/31/balances/32' \ -H 'accept: application/json' { "Balance": 0 }

New test 3: Tom and Jerry don’t know how to do math and plan to split the bill for dinner but don’t know how much each has to pay on a 95 dollar bill. They decide to use the service to help them calculate the math, by first creating users by calling /users then creating a group with /groups and them adding themselves to the group by calling /groups/{group_id}/addUser/{user_id}. Then logging a purchase with /groups/{group_id}/users/{user_id}/purchases. Then finally Jerry can pay Tom half of the bill.

User Goal: Split the bill

API Spec: Create users, group, and add to group. Split the bill and pay for half.

1.curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Tom", "email": "cat@gmail.com", "phone": "1234567890" }' { "new_user_id": 34 } 2.curl -X 'POST' \ 'https://better-mo.onrender.com/users/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Jerry", "email": "mouse@gmail.com", "phone": "1234567890" }' { "new_user_id": 35 }

  1. curl -X 'POST' \ 'https://better-mo.onrender.com/groups/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Tom & Jerry", "description": "Dinner group" }' { "new_group_id": 18 } 4.curl -X 'POST' \ 'https://better-mo.onrender.com/groups/18/addUser/34' \ -H 'accept: application/json' \ -d '' { "id": 44 } curl -X 'POST' \ 'https://better-mo.onrender.com/groups/18/addUser/35' \ -H 'accept: application/json' \ -d '' { "id": 45 } 5.curl -X 'POST' \ 'https://better-mo.onrender.com/groups/18/users/34/purchases' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "description": "Dinner", "price": 95 }' "OK"
  2. curl -X 'GET' \ 'https://better-mo.onrender.com/users/34/balances/35' \ -H 'accept: application/json' { "Balance": -47.50 } 7.curl -X 'POST' \ 'https://better-mo.onrender.com/users/35/pay/34' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "amount": 47.50, "description": "snacks" }' { "Amount paid": 47.5 }