Luke-Fanguna / FoodForLesser

0 stars 0 forks source link

Test Results (Dennis Phun) #30

Open dphun123 opened 1 year ago

dphun123 commented 1 year ago

Example workflow 1

Josh lives with 3 of his friends and is looking for a way to grocery shop efficiently for the household. He discovers FoodForLesser and is ecstatic! First, Josh creates his grocery list by calling POST /lists. He then adds a list of items to his grocery list. To do so he: calls POST /lists/2/items/1/2/ to add item_id: 1, ketchup to his list. Calls POST /lists/1/items/2/3 to add hotdogs to his list. Calls POST /lists/1/items/3/1 to add bread to his list. He then wants to check his list so he calls GET /lists/{list_id}. Finally, he calls POST /stores/1/distribute to get the cheapest store for each item in his list Now with his distributed list of grocery items with their respective store(s), he and his roommates can effectively split up their grocery needs, in which each roommate can go to one grocery store and get the item that is cheapest there.

Testing results 1

  1. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/lists/?user_id=3' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "list_id": 8 }
  2. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/lists/8/items/1/2' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "posting_id": 21 }
  3. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/lists/8/items/2/3' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "posting_id": 22 }
  4. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/lists/8/items/3/1' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "posting_id": 23 }
  5. curl -X 'GET' \ 'https://food-for-lesser.onrender.com/lists/8' \ -H 'accept: application/json' \ -H 'access_token: food'

    • Response: { "item_id": 1, "item": "Ketchup", "quantity": 2 }, { "item_id": 2, "item": "Hotdogs", "quantity": 3 }, { "item_id": 3, "item": "Bread", "quantity": 1 }
  6. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/lists/stores/8/distribute (POST)' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response : [ { "Store": "Ralphs", "Item": "Ketchup", "Price": 3 }, { "Store": "Ralphs", "Item": "Hotdogs", "Price": 3 }, { "Store": "Costco", "Item": "Bread", "Price": 2 } ]
  7. curl -X 'DELETE' \ 'https://food-for-lesser.onrender.com/crowdsourcing/1/delete' \ -H 'accept: application/json' \ -H 'access_token: food'

    • Response: "OK"

not quite sure what this is for

Example workflow 2

Misaki is a single mother. She wants to find a store that is close by with cheap groceries so her and her child won’t starve. She desperately needs baby food and caffeine. She requests a list of stores near her location by calling GET /stores. This gives her the list of stores. She then makes her own grocery list by calling POST /lists. She wants to add doritos and milk to her list and find the grocery store where the total cost of her list would be the cheapest. To do so she: Calls POST /lists/4/items/4/3 to add 3 bags of doritos to her list and calls POST /lists/4/items/8/1 to add 1 carton of milk to her list. Then, she confirms her list by callling GET /lists/4. Finally, she calls POST lists/stores/4/best which will give her the store that would give her the cheapest list

Testing results 2

  1. curl -X 'GET' \ 'http://127.0.0.1:8000/lists/stores/ (GET)' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: [ { "id": 1, "name": "Safeway" }, { "id": 2, "name": "Ralphs" }, { "id": 3, "name": "Costco" }, { "id": 4, "name": "Smart & Final" }, { "id": 5, "name": "Grocery Outlet" } ]
  2. curl -X 'POST' \ 'http://127.0.0.1:8000/lists/?user_id=4' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "list_id" : 9}
  3. curl -X 'POST' \ 'http://127.0.0.1:8000/lists/9/items/4/3' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "posting_id" : 24}
  4. curl -X 'POST' \ 'http://127.0.0.1:8000/lists/9/items/8/1' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "posting_id" : 25}
  5. curl -X 'GET' \ 'http://127.0.0.1:8000/lists/9' \ -H 'accept: application/json' \ -H 'access_token: food'

    • Response: [ { "item_id": 4, "item": "Doritos", "quantity": 3 }, { "item_id": 8, "item": "Milk", "quantity": 1 } ]
  6. curl -X 'POST' \ 'http://127.0.0.1:8000/lists/stores/9/best (POST)' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: { "store_id": 5 }

Example Workflow 3

LilNHo is a helpful citizen, LilNHo finds eggs for half off deal at Costco and wants to share his find with others! He opens up Food4Lesser and creates a new grocery price posting for everyone to see. In his excitement, he accidentally makes a typo. He quickly updates the price of his post and goes on with shopping. Later when he is leaving, he realizes many people saw his post and came to Costco to buy eggs. With the eggs sold out, he deletes his posting so no one else comes to Costco disappointed.

Results 3

  1. curl -X 'POST' \ 'https://food-for-lesser.onrender.com/crowdsourcing/3/upload/2/10/9.99?inventory_levels=medium' \ -H 'accept: application/json' \ -H 'access_token: food' \ -d ''

    • Response: "26"
  2. curl -X 'PUT' \ 'https://food-for-lesser.onrender.com/crowdsourcing/26/update/4.99' \ -H 'accept: application/json' \ -H 'access_token: food'

    • Response: "OK"
  3. curl -X 'DELETE' \ 'https://food-for-lesser.onrender.com/crowdsourcing/26/delete' \ -H 'accept: application/json' \ -H 'access_token: food'

    • Response: "OK"
dphun123 commented 1 year ago

1. Finding the best store with many items

John is a busy guy who is seeking to meal prep for the upcoming week. He wants to use Food4Lesser to find the best store that he can get everything he needs in one store trip.

To do so, he:

Testing results

1. POST /lists

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/?user_id=1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "list_id": 12
}

2. POST /lists/12/items/1/2

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/12/items/1/2' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 26
}

3. POST /lists/12/items/2/3

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/12/items/2/3' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 27
}

4. POST /lists/12/items/3/1

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/12/items/3/1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 28
}

5. POST /lists/12/items/4/3

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/12/items/4/3' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 29
}

6. POST /lists/12/items/8/1

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/12/items/8/1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 30
}

7. POST lists/stores/12/best

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/stores/12/best (POST)' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  Internal Server Error
}
dphun123 commented 1 year ago

2. Accidentally Adding Duplicate Items

John, in his haste, accidentally adds two identical items to his grocery list. He would want to know that he made an error.

In order, he:

Testing Results

1. POST /lists

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/?user_id=1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "list_id": 13
}

2. POST /lists/13/items/1/2

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/13/items/1/2' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 31
}

3. POST /lists/13/items/2/3

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/13/items/2/3' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 32
}

4. POST /lists/13/items/3/1

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/13/items/3/1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 33
}

5. POST /lists/13/items/3/1

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/13/items/3/1' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

{
  "posting_id": 34
}

Rather than receiving an error or warning, John is able to successfully add the duplicate to his grocery list.

dphun123 commented 1 year ago

3. Crowdsourcing Post with $0 Item

Bobby is using Food4Lesser and wants to share an item he found that is at an "exceptionally great value", priced at $0 (according to him)! Free hotdogs at Ralphs, apparently.

To do so, he:

Testing Results

1. POST /crowdsourcing/1/upload/2/2/0?inventory_levels=medium

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/crowdsourcing/1/upload/2/2/0?inventory_levels=medium' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

27

2. POST /lists/stores/12/distribute

curl -X 'POST' \
  'https://food-for-lesser.onrender.com/lists/stores/12/distribute (POST)' \
  -H 'accept: application/json' \
  -H 'access_token: food' \
  -d ''

Response:

[
  {
    "Store": "Ralphs",
    "Item": "Ketchup",
    "Price": 3
  },
  {
    "Store": "Ralphs",
    "Item": "Hotdogs",
    "Price": 0
  },
  {
    "Store": "Costco",
    "Item": "Bread",
    "Price": 2
  },
  {
    "Store": "Grocery Outlet",
    "Item": "Doritos",
    "Price": 3
  },
  {
    "Store": "Smart & Final",
    "Item": "Milk",
    "Price": 3
  }
]

The next morning, John and many others are left crowding Ralphs, searching for the free hotdogs.