@@ -73,6 +73,55 @@ Feature: Posts Endpoint
7373 Then the response has a status code of 200
7474 And the response body is an empty JSON object
7575
76+ Scenario : Update post with empty request body
77+ # This API isn't backed by a working data source so there is no follow up GET request to confirm that the
78+ # post has been properly updated in the back end
79+ When I make a PUT request with an empty body to the Posts endpoint with a path parameter of 1
80+ Then the response has a status code of 200
81+ And the response body matches the following
82+ | key | value |
83+ | id | 1 |
84+
85+ Scenario : Update post with partial request body
86+ When I make a PUT request with the following body to the Posts endpoint with a path parameter of 1
87+ | key | value |
88+ | title | Updated Post Title |
89+ | body | Updated post body text |
90+ Then the response has a status code of 200
91+ And the response body matches the following
92+ | key | value |
93+ | id | 1 |
94+ | title | Updated Post Title |
95+ | body | Updated post body text |
96+
97+ Scenario : Update post with full request body
98+ When I make a PUT request with the following body to the Posts endpoint with a path parameter of 1
99+ | key | value |
100+ | title | Updated Post Title |
101+ | body | Updated post body text |
102+ | userId | 5 |
103+ Then the response has a status code of 200
104+ And the response body matches the following
105+ | key | value |
106+ | id | 1 |
107+ | title | Updated Post Title |
108+ | body | Updated post body text |
109+ | userId | 5 |
110+
111+ Scenario : Update post with invalid fields in request body
112+ # As this API isn't linked to a working data source there is no validation of the field names passed in via the
113+ # request body. If this were a fully working API I would expect this to raise an error
114+ When I make a PUT request with the following body to the Posts endpoint with a path parameter of 1
115+ | key | value |
116+ | key_1 | New value |
117+ | key_2 | New value |
118+ Then the response has a status code of 200
119+ And the response body matches the following
120+ | key | value |
121+ | id | 1 |
122+ | key_1 | New value |
123+ | key_2 | New value |
124+
76125 Scenario Outline : Delete post with invalid ID - post #<ID>
77126 # As this is a fake API without an underlying data source that updates based on the API requests, a delete request
78127 # returns a success response regardless of the post ID passed in via the path parameters. This should raise an error
0 commit comments