Skip to content

Commit 114dcff

Browse files
committed
Merge branch 'feature/PI-562-test_deleted_product' into release/2024-10-16
2 parents 0013c69 + f7a9a7e commit 114dcff

File tree

3 files changed

+72
-2
lines changed

3 files changed

+72
-2
lines changed

src/api/tests/feature_tests/features/readCpmProduct.failure.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,26 @@ Feature: Read CPM Product - failure scenarios
4646
| name | value |
4747
| Content-Type | application/json |
4848
| Content-Length | 152 |
49+
50+
Scenario: Can't read a deleted Product
51+
Given I have already made a "POST" request with "default" headers to "ProductTeam" with body:
52+
| path | value |
53+
| name | My Great Product Team |
54+
| ods_code | F5H1R |
55+
| keys.0.key_type | product_team_id_alias |
56+
| keys.0.key_value | FOOBAR |
57+
Given I note the response field "$.id" as "product_team_id"
58+
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product" with body:
59+
| path | value |
60+
| product_name | My Great Product |
61+
And I note the response field "$.id" as "product_id"
62+
And I have already made a "DELETE" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }"
63+
When I make a "GET" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }"
64+
Then I receive a status code "404" with body
65+
| path | value |
66+
| errors.0.code | RESOURCE_NOT_FOUND |
67+
| errors.0.message | Could not find CpmProduct for key ('${ note(product_team_id) }', '${ note(product_id) }') |
68+
And the response headers contain:
69+
| name | value |
70+
| Content-Type | application/json |
71+
| Content-Length | 152 |

src/api/tests/feature_tests/features/searchCpmProduct.success.feature

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Feature: Search CPM Products - success scenarios
6868
| path | value |
6969
| product_name | My Great Product 3 |
7070
When I make a "GET" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product"
71-
Then I receive a status code "200" with a "product" search body reponse that contains
71+
Then I receive a status code "200" with a "product" search body response that contains
7272
| path | value |
7373
| 0.id | << ignore >> |
7474
| 0.product_team_id | ${ note(product_team_id) } |
@@ -101,3 +101,50 @@ Feature: Search CPM Products - success scenarios
101101
| name | value |
102102
| Content-Type | application/json |
103103
| Content-Length | 777 |
104+
105+
Scenario: Deleted Products not returned in search
106+
Given I have already made a "POST" request with "default" headers to "ProductTeam" with body:
107+
| path | value |
108+
| name | My Great Product Team |
109+
| ods_code | F5H1R |
110+
| keys.0.key_type | product_team_id_alias |
111+
| keys.0.key_value | FOOBAR |
112+
And I note the response field "$.id" as "product_team_id"
113+
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product" with body:
114+
| path | value |
115+
| product_name | My Great Product 1 |
116+
And I note the response field "$.id" as "product_id_1"
117+
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product" with body:
118+
| path | value |
119+
| product_name | My Great Product 2 |
120+
And I note the response field "$.id" as "product_id_2"
121+
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product" with body:
122+
| path | value |
123+
| product_name | My Great Product 3 |
124+
And I note the response field "$.id" as "product_id_3"
125+
And I have already made a "DELETE" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id_2) }"
126+
When I make a "GET" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product"
127+
Then I receive a status code "200" with a "product" search body response that contains
128+
| path | value |
129+
| 0.id | ${ note(product_id_1) } |
130+
| 0.product_team_id | ${ note(product_team_id) } |
131+
| 0.name | My Great Product 1 |
132+
| 0.ods_code | F5H1R |
133+
| 0.status | active |
134+
| 0.keys | [] |
135+
| 0.created_on | << ignore >> |
136+
| 0.updated_on | << ignore >> |
137+
| 0.deleted_on | << ignore >> |
138+
| 1.id | ${ note(product_id_3) } |
139+
| 1.product_team_id | ${ note(product_team_id) } |
140+
| 1.name | My Great Product 3 |
141+
| 1.ods_code | F5H1R |
142+
| 1.status | active |
143+
| 1.keys | [] |
144+
| 1.created_on | << ignore >> |
145+
| 1.updated_on | << ignore >> |
146+
| 1.deleted_on | << ignore >> |
147+
And the response headers contain:
148+
| name | value |
149+
| Content-Type | application/json |
150+
| Content-Length | 518 |

src/api/tests/feature_tests/steps/steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def then_response(context: Context, status_code: str, list_to_check: str, count:
195195

196196

197197
@then(
198-
'I receive a status code "{status_code}" with a "{entity_type}" search body reponse that contains'
198+
'I receive a status code "{status_code}" with a "{entity_type}" search body response that contains'
199199
)
200200
def then_response(context: Context, status_code: str, entity_type: str):
201201
expected_body = parse_table(table=context.table, context=context)

0 commit comments

Comments
 (0)