spruhaN / nutrition_pal

1 stars 1 forks source link

Test Results (Rhoyalinn Cereno) #14

Open rcereno opened 1 month ago

rcereno commented 1 month ago

Example Workflow (I wrote it out on GitHub then it disappeared /did not save so rewrote this again)

Flow 1: Create User and Log a Goal and a Workout.

  1. POST /user

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/user' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "Rhoyalinn",
    "weight": 110,
    "height": 60
    }'
  2. Test Results / Response Body

{
  "id": 60
}
  1. POST /goals/{customer_id}
    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/goals/60' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "goal": "lose 5% body fat",
    "type": "cut diet",
    "daily_calories": 1500
    }'

    AND POST /goals/{customer_id}

curl -X 'POST' \
  'https://nutrition-pal.onrender.com/goals/60' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "goal": "get up to 150 deadlift PR",
  "type": "workout PR",
  "daily_calories": 1500
}'
  1. Test Results / Response Body:
"OK"

AND

"OK"
  1. POST /workout/{customer_id}
    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/workout/60' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "pull_up",
    "sets": 3,
    "reps": 8,
    "length": 30
    }'

    AND

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/workout/60' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "squat",
    "sets": 3,
    "reps": 15,
    "length": 25
    }'
  2. Test Result / Response Body
    "OK"

    AND

    "OK"

**Flow 2: Make a calorie goal, log meals/calories eaten, and look up meals of day and calories left.

  1. POST /goals/{customer_id}

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/goals/60' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "goal": "calorie deficit of 300 calories - original 1800",
    "type": "cut diet",
    "daily_calories": 1500
    }'
  2. Test Result / Response Body

    "OK"
  3. GET /daily_calories/{customer_id}

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/daily_calories/60' \
    -H 'accept: application/json'
  4. Test Result / Response Body

    {
    "calories_left": 1500
    }
  5. POST /meal/{customer_id}

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/meal/60' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "snack",
    "calories": 50
    }'
  6. Test Result / Response Body

    "OK"
  7. GET /daily_calories/{customer_id}

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/daily_calories/60' \
    -H 'accept: application/json'
  8. Test Result / Response Body

    {
    "calories_left": 1450
    }
  9. GET /meal/{customer_id}/day

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/meal/60/day' \
    -H 'accept: application/json'
  10. Test Result / Response Body

    [
    {
    "name": "string",
    "calories": 50,
    "time": "2024-05-21T21:48:29.548366+00:00",
    "type": null
    }
    ]

Flow 3: Get a set of workouts based off of muscle groups and muscle types

  1. GET /workouts/{customer_id}/day

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/workouts/60/day' \
    -H 'accept: application/json'
  2. Test Results / Response Body

    [
    {
    "id": 15,
    "name": "deadlift",
    "type": "legs",
    "group": "glutes",
    "sets": 3,
    "reps": 8,
    "length": 30
    },
    {
    "id": 20,
    "name": "squat",
    "type": "legs",
    "group": "quads",
    "sets": 3,
    "reps": 8,
    "length": 30
    },
    {
    "id": 9,
    "name": "pull_up",
    "type": "back",
    "group": "lats",
    "sets": 3,
    "reps": 8,
    "length": 30
    }
    ]
  3. GET /workouts/muscle_groups/{type}

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/workouts/muscle_groups/back' \
    -H 'accept: application/json'
  4. Test Results / Response Body

    [
    {
    "name": "lat_pulldown",
    "type": "back",
    "group": "lats"
    },
    {
    "name": "cable_row",
    "type": "back",
    "group": "traps"
    },
    {
    "name": "pull_up",
    "type": "back",
    "group": "lats"
    },
    {
    "name": "bent_over_dumbell_row",
    "type": "back",
    "group": "lats"
    }
    ]
  5. GET /workout/{workout_id}/muscle_groups

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/workout/1/muscle_groups' \
    -H 'accept: application/json'
  6. Test Results / Response Body

    [
    {
    "name": "lat_pulldown",
    "type": "back",
    "group": "lats"
    }
    ]

Flow 4: Create new user to database and add a workout. Then check their workout of the day

  1. POST /user

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/user' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "Bob",
    "weight": 180,
    "height": 80
    }'
  2. Test Result / Response Body

    {
    "id": 62
    }
  3. POST /workout/{customer_id}

    curl -X 'POST' \
    'https://nutrition-pal.onrender.com/workout/62' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "deadlift",
    "sets": 4,
    "reps": 5,
    "length": 50
    }'
  4. Test Results / Response Body

    "OK"
  5. GET /workouts/{customer_id}/day

    curl -X 'GET' \
    'https://nutrition-pal.onrender.com/workouts/62/day' \
    -H 'accept: application/json'
  6. Test Result / Response Body

    [
    {
    "id": 15,
    "name": "deadlift",
    "type": "legs",
    "group": "glutes",
    "sets": 4,
    "reps": 5,
    "length": 50
    }
    ]
rcereno commented 1 month ago

Copied this from project's example flow file but above comment was my own personal flows yet still tests these different type of flows the group project listed:

Flow 1. Tracking daily calories and inputting workouts

Stephanie has some goals and wants to start tracking her calories and meals.
First she POST /goals passing “lose weight”, “diet” and 2000
Next she eats food and does a POST /meal passing “Mexican” and 800.
She wants to see how many calories she has left GET /daily_calories returning 1200.
She then eats a pizza, POSTS /meal passing “Italian” 1200.
Checks calories with GET /daily_calories, returns 0.
Next day GET /meal/day returning a list of meals with an id, type, calorie, and time stamp

Testing Results

  1. curl -X 'POST' \ 'https://fast-api-practice.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Stephanie", "weight": 100, "height": 100 }' 
  2. { "id" : 41 }
  3. curl -X 'POST'
    'https://nutrition-pal.onrender.com/goals/41'
    -H 'accept: application/json'
    -H 'Content-Type: application/json'
    -d '{
    "goal": "lose weight",
    "type": "diet",
    "daily_calories": 2000
    }'
  4. "OK"
  5. curl -X 'POST'
    'https://nutrition-pal.onrender.com/meal/41'
    -H 'accept: application/json'
    -H 'Content-Type: application/json'
    -d '{
    "name": "Mexican",
    "calories": 800
    }'
  6. "OK"
  7. curl -X 'GET'
    'https://nutrition-pal.onrender.com/daily_calories/41'
    -H 'accept: application/json'
  8. {
    "calories_left": 1200
    }
  9. curl -X 'POST'
    'https://nutrition-pal.onrender.com/meal/41'
    -H 'accept: application/json'
    -H 'Content-Type: application/json'
    -d '{
    "name": "Italian",
    "calories": 1200
    }'
  10. "OK"
  11. curl -X 'GET'
    '[https://fast-api-practice.onrender.com/daily_calories/41’](https://fast-api-practice.onrender.com/daily_calories/41%E2%80%99)
    -H 'accept: application/json'
  12. {
    "calories_left": 0
    }
  13. curl -X 'GET'
    'https://fast-api-practice.onrender.com/meal/41/day'
    -H 'accept: application/json'
  14. [
    {
    "name": "Mexican",
    "calories": 800,
    "time": "2024-05-21T03:15:08.626102+00:00",
    "type": null
    },
    {
    "name": "Italian",
    "calories": 1200,
    "time": "2024-05-21T03:17:52.809226+00:00",
    "type": null
    }
    ]

Flow 2. Adding and looking up workout

Marc wants to build muscle
Marc enters his goals by calling POST /goals passing “get big”, “workout”, 2800.
He then begins adding workouts with with POST /workout passing “push-up”, 3, 10, 14.
He does this with multiple workouts at varying lengths, set, reps.
His friends asks him what workouts he’s done, so he GET /workouts/days and returns a list of workout with “id”, “name”, “sets”, “reps”, “length”, and “time”
His friend asks what to do for back, GET /workout/muscle_group/{type} passing “back” as type and returns a list of workouts “id”, “name”, “sets”, “reps”, “length”, and “time”, for the back

Testing Results

Create Marco's Information

curl -X 'POST'
'https://nutrition-pal.onrender.com/user'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Marco”,
"weight": 150,
"height": 189
}'
{
"id" : 42
}

Marco enters his goals:

curl -X 'POST'
'https://nutrition-pal.onrender.com/goals/42'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"goal": "get big",
"type": "workout",
"daily_calories": 2800
}'
"OK"

Marco adds his deadlift workout:

curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/42’](https://nutrition-pal.onrender.com/workout/42%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "deadlift",
"sets": 3,
"reps": 10,
"length": 2
}'
"OK"

Marco adds more workouts:

curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/42’](https://nutrition-pal.onrender.com/workout/42%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "pull_up",
"sets": 3,
"reps": 10,
"length": 50
}'
"OK"

Marco checks what he has done:

curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/42/day'
-H 'accept: application/json'
[
{
"id": 15,
"name": "deadlift",
"type": "legs",
"group": "glutes",
"sets": 3,
"reps": 10,
"length": 2
},
{
"name": "pull_up",
"sets": 3,
"reps": 10,
"length": 50
}'

Marco checks for back workouts

curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/muscle_groups/back'
-H 'accept: application/json'
[
{
"name": "lat_pulldown",
"type": "back",
"group": "lats"
},
{
"name": "cable_row",
"type": "back",
"group": "traps"
},
{
"name": "pull_up",
"type": "back",
"group": "lats"
},
{
"name": "bent_over_dumbell_row",
"type": "back",
"group": "lats"
}
]

Flow 3. Finding workout muscle_groups

Andrew M. is jealous of his roommate’s incredible physique.
Andrew starts with a POST /goals passing “get big”, “workout”, 2800.
He posts a workout POST /workout “pull-up”, 3, 4, 10.
He does this for a variety of workouts.
He wants to see what his workouts hit so he starts with GET /workout/day and gets a list of “id”, “name”, “sets”, “reps”, “length”, and “time”
He wants to see what his chest-press hits so he does a GET /workout/{id}/muscle_groups passing an id in that was in the prior return.
This returns a list of strings [“chest”, “triceps”, “shoulders”]

Create an account for Andrew M.:

curl -X 'POST'
'https://nutrition-pal.onrender.com/user'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "Andrew M.",
"weight": 90,
"height": 189
}'
{
"id": 43
}

Andrew sets a goal:

curl -X 'POST'
'[https://nutrition-pal.onrender.com/goals/43’](https://nutrition-pal.onrender.com/goals/43%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"goal": "get huge",
"type": "workout",
"daily_calories": 5000
}'
"OK"

Andrew posts a workout:

curl -X 'POST'
'[https://nutrition-pal.onrender.com/workout/43’](https://nutrition-pal.onrender.com/workout/43%E2%80%99)
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"name": "squat",
"sets": 20,
"reps": 20,
"length": 0
}'
"OK"

Andrew wants to see what workouts to hit:

curl -X 'GET'
'https://nutrition-pal.onrender.com/workouts/43/day'
-H 'accept: application/json'
[
{
"id": 20,
"name": "squat",
"type": "legs",
"group": "quads",
"sets": 20,
"reps": 20,
"length": 0
}
]

Andrew wants to see his squat hits:

curl -X 'GET'
'https://nutrition-pal.onrender.com/workout/20/muscle_groups'
-H 'accept: application/json'
[
{
"name": "squat",
"type": "legs",
"group": "quads"
}
]