|
| 1 | +Feature: Test request to API sent like a HTML form |
| 2 | + In order to test my API |
| 3 | + As a developper |
| 4 | + I want to be able to perform HTTP request with HTML form data |
| 5 | + |
| 6 | + Scenario: Sending POST request as a HTML form |
| 7 | + When I send a POST request to "post-html-form" as HTML form with body: |
| 8 | + | object | name | value | |
| 9 | + | field | username | pablo | |
| 10 | + | field | password | money | |
| 11 | + | field | terms_accepted | 1 | |
| 12 | + Then the response status code should be 200 |
| 13 | + And the response should be in JSON |
| 14 | + And the JSON node "content_type_header_value" should contain "application/x-www-form-urlencoded" |
| 15 | + And the JSON node "post_fields_count" should be equal to "3" |
| 16 | + And the JSON node "post_fields.username" should be equal to "pablo" |
| 17 | + And the JSON node "post_fields.password" should be equal to "money" |
| 18 | + And the JSON node "post_fields.terms_accepted" should be equal to "1" |
| 19 | + |
| 20 | + Scenario: Sending POST request as a HTML form with files |
| 21 | + When I send a POST request to "post-html-form-with-files" as HTML form with body: |
| 22 | + | object | name | value | |
| 23 | + | field | username | pablo | |
| 24 | + | field | password | money | |
| 25 | + | field | terms_accepted | 1 | |
| 26 | + | file | test-img | features/bootstrap/fixtures/test-img.jpg | |
| 27 | + | file | json-schema | features/bootstrap/fixtures/json-schema.json | |
| 28 | + Then the response status code should be 200 |
| 29 | + And the response should be in JSON |
| 30 | + And the JSON node "content_type_header_value" should contain "multipart/form-data" |
| 31 | + And the JSON node "post_fields_count" should be equal to "3" |
| 32 | + And the JSON node "post_files_count" should be equal to "2" |
| 33 | + And the JSON node "post_fields.username" should be equal to "pablo" |
| 34 | + And the JSON node "post_fields.password" should be equal to "money" |
| 35 | + And the JSON node "post_fields.terms_accepted" should be equal to "1" |
0 commit comments