From 143cb3553785641a2a97045b6638e24bce4087cf Mon Sep 17 00:00:00 2001 From: Vidisha Holsambre Date: Tue, 30 Apr 2024 11:44:26 -0400 Subject: [PATCH] Added test case for listing all items in shopcart and updated README file --- README.md | 46 ++++++++++++++++++++++++++++++++++++++ features/shopcarts.feature | 19 +++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a632dc..ffc108f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,53 @@ tests/ - test cases package ├── test_models.py - test suite for data models └── test_routes.py - test suite for service routes ``` +## Models +##### `Shopcart` + +| `Name` | `Description` | `Data type` | +| ----------- | --------------------- | --------------- | +| id | Unique ID for the shopcart. | uuid | +| user_id | Unique ID tying a User ID to the shopcart. | uuid | +| items | List of items in the shopcart | `items` | + +##### `Item` + +| `Name` | `Description` | `Data type` | +| ----------- | --------------------- | --------------- | +| id | Unique ID for the item. | uuid | +| cart_id | ID of the shopcart it belongs to | uuid | +| product_name | Name of the product | String | +| product_id | ID of the product | uuid | +| quantity | Quantity of the product in the cart | Number | +| product_price | Price of the product when it was added | Float | + +## Routes + +```text +$ flask routes + +Endpoint Methods Rule +----------------------------- ------- ----------------------------------------------------- +index GET / +health GET /health + +create_shopcarts POST /api/shopcarts +get_shopcarts GET /api/shopcarts/ +list_shopcarts GET /api/shopcarts +update_shopcarts PUT /api/shopcarts/ + +delete_item DELETE /api/shopcarts//items/ +delete_items DELETE /api/shopcarts//items +list_items GET /api/shopcarts//items +create_item POST /api/shopcarts//items +get_item GET /api/shopcarts//items/ +update_shopcarts_item PUT /api/shopcarts//items/ +clear_shopcart DELETE /api/shopcarts//items/clear +increment_item_quantity PUT /api//shopcarts//items//increment +decrement_item_quantity PUT /api/shopcarts//items//decrement +``` ## License Copyright (c) 2016, 2024 [John Rofrano](https://www.linkedin.com/in/JohnRofrano/). All rights reserved. diff --git a/features/shopcarts.feature b/features/shopcarts.feature index f65c830..ba69b40 100644 --- a/features/shopcarts.feature +++ b/features/shopcarts.feature @@ -142,4 +142,21 @@ Feature: The shopcarts service back-end And the "Item ID" field should not be empty And the "Item Product ID" field should not be empty And the "Item Product Price" field should not be empty - And the "Item Quantity" field should not be empty \ No newline at end of file + And the "Item Quantity" field should not be empty + + # LIST ALL ITEMS IN SHOPCART + Scenario: List all items in shopcart + When I visit the "Home Page" + And I set the "Shopcart User ID" to "1" + And I press the "Search Shopcart" button + Then I should see the message "Success" + When I copy the "Shopcart ID" field + And I paste the "Item Shopcart ID" field + And I press the "Search Item" button + Then the "Item ID" field should not be empty + And the "Item Product Name" field should not be empty + And the "Item Product ID" field should not be empty + And the "Item Product Price" field should not be empty + And the "Item Quantity" field should not be empty + + \ No newline at end of file