PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/features/command_line.feature

http://github.com/jnunemaker/httparty
Gherkin Specification | 95 lines | 82 code | 13 blank | 0 comment | 1 complexity | c0053c9d54555aab4bacffb0e8e9214a MD5 | raw file
 1@command_line
 2Feature: Command Line
 3
 4  As a developer
 5  I want to be able to harness the power of HTTParty from the command line
 6  Because that would make quick testing and debugging easy
 7
 8  Scenario: Show help information
 9    When I run `httparty --help`
10    Then the output should contain "-f, --format [FORMAT]"
11
12  Scenario: Show current version
13    When I run `httparty --version`
14    Then the output should contain "Version:"
15    And the output should not contain "You need to provide a URL"
16
17  Scenario: Make a get request
18    Given a remote deflate service on port '4001'
19    And the response from the service has a body of 'GET request'
20    And that service is accessed at the path '/fun'
21    When I run `httparty http://0.0.0.0:4001/fun`
22    Then the output should contain "GET request"
23
24  Scenario: Make a post request
25    Given a remote deflate service on port '4002'
26    And the response from the service has a body of 'POST request'
27    And that service is accessed at the path '/fun'
28    When I run `httparty http://0.0.0.0:4002/fun --action post --data "a=1&b=2"`
29    Then the output should contain "POST request"
30
31  Scenario: Make a put request
32    Given a remote deflate service on port '4003'
33    And the response from the service has a body of 'PUT request'
34    And that service is accessed at the path '/fun'
35    When I run `httparty http://0.0.0.0:4003/fun --action put --data "a=1&b=2"`
36    Then the output should contain "PUT request"
37
38  Scenario: Make a delete request
39    Given a remote deflate service on port '4004'
40    And the response from the service has a body of 'DELETE request'
41    And that service is accessed at the path '/fun'
42    When I run `httparty http://0.0.0.0:4004/fun --action delete`
43    Then the output should contain "DELETE request"
44
45  Scenario: Set a verbose mode
46    Given a remote deflate service on port '4005'
47    And the response from the service has a body of 'Some request'
48    And that service is accessed at the path '/fun'
49    When I run `httparty http://0.0.0.0:4005/fun --verbose`
50    Then the output should contain "content-length"
51
52  Scenario: Use service with basic authentication
53    Given a remote deflate service on port '4006'
54    And the response from the service has a body of 'Successfull authentication'
55    And that service is accessed at the path '/fun'
56    And that service is protected by Basic Authentication
57    And that service requires the username 'user' with the password 'pass'
58    When I run `httparty http://0.0.0.0:4006/fun --user 'user:pass'`
59    Then the output should contain "Successfull authentication"
60
61  Scenario: Get response in plain format
62    Given a remote deflate service on port '4007'
63    And the response from the service has a body of 'Some request'
64    And that service is accessed at the path '/fun'
65    When I run `httparty http://0.0.0.0:4007/fun --format plain`
66    Then the output should contain "Some request"
67
68  Scenario: Get response in json format
69    Given a remote deflate service on port '4008'
70    Given a remote service that returns '{ "jennings": "waylon", "cash": "johnny" }'
71    And that service is accessed at the path '/service.json'
72    And the response from the service has a Content-Type of 'application/json'
73    When I run `httparty http://0.0.0.0:4008/service.json --format json`
74    Then the output should contain '"jennings": "waylon"'
75
76  Scenario: Get response in xml format
77    Given a remote deflate service on port '4009'
78    Given a remote service that returns '<singer>waylon jennings</singer>'
79    And that service is accessed at the path '/service.xml'
80    And the response from the service has a Content-Type of 'text/xml'
81    When I run `httparty http://0.0.0.0:4009/service.xml --format xml`
82    Then the output should contain "<singer>"
83
84  Scenario: Get response in csv format
85    Given a remote deflate service on port '4010'
86    Given a remote service that returns:
87      """
88      "Last Name","Name"
89      "jennings","waylon"
90      "cash","johnny"
91      """
92    And that service is accessed at the path '/service.csv'
93    And the response from the service has a Content-Type of 'application/csv'
94    When I run `httparty http://0.0.0.0:4010/service.csv --format csv`
95    Then the output should contain '["Last Name", "Name"]'