Skip to content

Commit

Permalink
Merge pull request #130 from CSCI-GA-2820-SP24-001/last-test-case
Browse files Browse the repository at this point in the history
Added test case for listing all items in shopcart and updated README file
  • Loading branch information
sp7455 authored Apr 30, 2024
2 parents aaec77e + 143cb35 commit 15231fb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<int:shopcart_id
delete_shopcarts DELETE /api/shopcarts/<int:shopcart_id>
list_shopcarts GET /api/shopcarts
update_shopcarts PUT /api/shopcarts/<int:shopcart_id>
delete_item DELETE /api/shopcarts/<int:shopcart_id>/items/<int:product_id>
delete_items DELETE /api/shopcarts/<int:shopcart_id>/items
list_items GET /api/shopcarts/<int:shopcart_id>/items
create_item POST /api/shopcarts/<int:shopcart_id>/items
get_item GET /api/shopcarts/<int:shopcart_id>/items/<int:product_id>
update_shopcarts_item PUT /api/shopcarts/<int:shopcart_id>/items/<int:product_id>
clear_shopcart DELETE /api/shopcarts/<int:shopcart_id>/items/clear
increment_item_quantity PUT /api//shopcarts/<int:shopcart_id>/items/<int:item_id>/increment
decrement_item_quantity PUT /api/shopcarts/<int:shopcart_id>/items/<int:item_id>/decrement
```
## License

Copyright (c) 2016, 2024 [John Rofrano](https://www.linkedin.com/in/JohnRofrano/). All rights reserved.
Expand Down
19 changes: 18 additions & 1 deletion features/shopcarts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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


0 comments on commit 15231fb

Please sign in to comment.