Skip to content

Commit

Permalink
post data model structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Prasanna172 committed Apr 10, 2024
1 parent 0315265 commit 5be9dce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 3 additions & 5 deletions features/promotions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ Feature: The promotion store service back-end

Background:
Given the following promotions
| name | category | available | gender | birthday |
| fido | dog | True | MALE | 2019-11-18 |
| kitty | cat | True | FEMALE | 2020-08-13 |
| leo | lion | False | MALE | 2021-04-01 |
| sammy | snake | True | UNKNOWN | 2018-06-04 |
| cust_promo_code | type | value | quantity | start_date | end_date | active | product_id | dev_created_at |
| JULY4 | SAVING | 50 | 10 | 2024-03-05 | 2024-03-10 | True | 33422 | 2024-03-05 |
| JUN2 | BOGO | 20 | 5 | 2024-03-05 | 2024-03-10 | True | 2928383 | 2024-03-05 |

Scenario: The server is running
When I visit the "Home Page"
Expand Down
14 changes: 9 additions & 5 deletions features/steps/promotions_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ def step_impl(context):
# load the database with new promotions
for row in context.table:
payload = {
"name": row["name"],
"category": row["category"],
"available": row["available"] in ["True", "true", "1"],
"gender": row["gender"],
"birthday": row["birthday"],
"cust_promo_code": row["cust_promo_code"],
"type": row["type"],
"value": row["value"],
"quantity": row["quantity"],
"start_date": row["start_date"],
"end_date": row["end_date"],
"active": row["active"] in ["True", "true", "1"],
"product_id": row["product_id"],
"dev_created_at": row["dev_created_at"]
}
context.resp = requests.post(rest_endpoint, json=payload)
assert context.resp.status_code == HTTP_201_CREATED

0 comments on commit 5be9dce

Please sign in to comment.