@@ -122,6 +122,47 @@ Feature: Posts Endpoint
122122 | key_1 | New value |
123123 | key_2 | New value |
124124
125+ Scenario : Create new post with partial request body
126+ # New posts will always be created with the same ID (101) as there is no database behind this API
127+ When I make a POST request with the following body to the Posts endpoint
128+ | key | value |
129+ | title | New Post Title |
130+ | body | New post body text |
131+ Then the response has a status code of 201
132+ And the response body matches the following
133+ | key | value |
134+ | id | 101 |
135+ | title | New Post Title |
136+ | body | New post body text |
137+
138+ Scenario : Create new post with full request body
139+ When I make a POST request with the following body to the Posts endpoint
140+ | key | value |
141+ | title | New Post Title |
142+ | body | New post body text |
143+ | userId | 3 |
144+ Then the response has a status code of 201
145+ And the response body matches the following
146+ | key | value |
147+ | id | 101 |
148+ | title | New Post Title |
149+ | body | New post body text |
150+ | userId | 3 |
151+
152+ Scenario : Create new post with invalid fields in request body
153+ # As there is no data source behind this API, POST requests are not validated against the data schema so invalid
154+ # fields can be passed in the request body. For a real API this would throw an error
155+ When I make a POST request with the following body to the Posts endpoint
156+ | key | value |
157+ | key_1 | New value |
158+ | key_2 | New value |
159+ Then the response has a status code of 201
160+ And the response body matches the following
161+ | key | value |
162+ | id | 101 |
163+ | key_1 | New value |
164+ | key_2 | New value |
165+
125166 Scenario Outline : Delete post with invalid ID - post #<ID>
126167 # As this is a fake API without an underlying data source that updates based on the API requests, a delete request
127168 # returns a success response regardless of the post ID passed in via the path parameters. This should raise an error
0 commit comments