1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Cucumber suite sends unique requests

Helpful for testing ephemeral response
This commit is contained in:
Sandro Turriate 2010-07-07 08:54:22 -04:00
parent d160df6c3b
commit d018df223c
7 changed files with 24 additions and 24 deletions

View file

@ -5,16 +5,16 @@ Feature: Basic Authentication
Because that is not an uncommon requirement Because that is not an uncommon requirement
Scenario: Passing no credentials to a page requiring Basic Authentication Scenario: Passing no credentials to a page requiring Basic Authentication
Given a restricted page at '/protected.html' Given a restricted page at '/basic_auth.html'
When I call HTTParty#get with '/protected.html' When I call HTTParty#get with '/basic_auth.html'
Then it should return a response with a 401 response code Then it should return a response with a 401 response code
Scenario: Passing proper credentials to a page requiring Basic Authentication Scenario: Passing proper credentials to a page requiring Basic Authentication
Given a remote service that returns 'Authenticated Page' Given a remote service that returns 'Authenticated Page'
And that service is accessed at the path '/protected.html' And that service is accessed at the path '/basic_auth.html'
And that service is protected by Basic Authentication And that service is protected by Basic Authentication
And that service requires the username 'jcash' with the password 'maninblack' And that service requires the username 'jcash' with the password 'maninblack'
When I call HTTParty#get with '/protected.html' and a basic_auth hash: When I call HTTParty#get with '/basic_auth.html' and a basic_auth hash:
| username | password | | username | password |
| jcash | maninblack | | jcash | maninblack |
Then the return value should match 'Authenticated Page' Then the return value should match 'Authenticated Page'

View file

@ -7,20 +7,20 @@ Feature: Deals with HTTP error codes
Scenario: A response of '404 - Not Found' Scenario: A response of '404 - Not Found'
Given a remote service that returns a 404 status code Given a remote service that returns a 404 status code
And that service is accessed at the path '/service.html' And that service is accessed at the path '/404_service.html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/404_service.html'
Then it should return a response with a 404 response code Then it should return a response with a 404 response code
Scenario: A response of '500 - Internal Server Error' Scenario: A response of '500 - Internal Server Error'
Given a remote service that returns a 500 status code Given a remote service that returns a 500 status code
And that service is accessed at the path '/service.html' And that service is accessed at the path '/500_service.html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/500_service.html'
Then it should return a response with a 500 response code Then it should return a response with a 500 response code
Scenario: A non-successful response where I need the body Scenario: A non-successful response where I need the body
Given a remote service that returns a 400 status code Given a remote service that returns a 400 status code
And the response from the service has a body of 'Bad response' And the response from the service has a body of 'Bad response'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/400_service.html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/400_service.html'
Then it should return a response with a 400 response code Then it should return a response with a 400 response code
And the return value should match 'Bad response' And the return value should match 'Bad response'

View file

@ -5,16 +5,16 @@ Feature: Digest Authentication
Because that is not an uncommon requirement Because that is not an uncommon requirement
Scenario: Passing no credentials to a page requiring Digest Authentication Scenario: Passing no credentials to a page requiring Digest Authentication
Given a restricted page at '/protected.html' Given a restricted page at '/digest_auth.html'
When I call HTTParty#get with '/protected.html' When I call HTTParty#get with '/digest_auth.html'
Then it should return a response with a 401 response code Then it should return a response with a 401 response code
Scenario: Passing proper credentials to a page requiring Digest Authentication Scenario: Passing proper credentials to a page requiring Digest Authentication
Given a remote service that returns 'Digest Authenticated Page' Given a remote service that returns 'Digest Authenticated Page'
And that service is accessed at the path '/protected.html' And that service is accessed at the path '/digest_auth.html'
And that service is protected by Digest Authentication And that service is protected by Digest Authentication
And that service requires the username 'jcash' with the password 'maninblack' And that service requires the username 'jcash' with the password 'maninblack'
When I call HTTParty#get with '/protected.html' and a digest_auth hash: When I call HTTParty#get with '/digest_auth.html' and a digest_auth hash:
| username | password | | username | password |
| jcash | maninblack | | jcash | maninblack |
Then the return value should match 'Digest Authenticated Page' Then the return value should match 'Digest Authenticated Page'

View file

@ -7,13 +7,13 @@ Feature: Handles Compressed Responses
Scenario: Supports deflate encoding Scenario: Supports deflate encoding
Given a remote deflate service Given a remote deflate service
And the response from the service has a body of '<h1>Some HTML</h1>' And the response from the service has a body of '<h1>Some HTML</h1>'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/deflate_service.html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/deflate_service.html'
Then the return value should match '<h1>Some HTML</h1>' Then the return value should match '<h1>Some HTML</h1>'
Scenario: Supports gzip encoding Scenario: Supports gzip encoding
Given a remote gzip service Given a remote gzip service
And the response from the service has a body of '<h1>Some HTML</h1>' And the response from the service has a body of '<h1>Some HTML</h1>'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/gzip_service.html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/gzip_service.html'
Then the return value should match '<h1>Some HTML</h1>' Then the return value should match '<h1>Some HTML</h1>'

View file

@ -8,9 +8,9 @@ Feature: Handles Multiple Formats
Scenario: An HTML service Scenario: An HTML service
Given a remote service that returns '<h1>Some HTML</h1>' Given a remote service that returns '<h1>Some HTML</h1>'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/html_service.html'
And the response from the service has a Content-Type of 'text/html' And the response from the service has a Content-Type of 'text/html'
When I call HTTParty#get with '/service.html' When I call HTTParty#get with '/html_service.html'
Then it should return a String Then it should return a String
And the return value should match '<h1>Some HTML</h1>' And the return value should match '<h1>Some HTML</h1>'

View file

@ -7,8 +7,8 @@ Feature: Supports Redirection
Scenario: A service that redirects once Scenario: A service that redirects once
Given a remote service that returns 'Service Response' Given a remote service that returns 'Service Response'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/landing_service.html'
And the url '/redirector.html' redirects to '/service.html' And the url '/redirector.html' redirects to '/landing_service.html'
When I call HTTParty#get with '/redirector.html' When I call HTTParty#get with '/redirector.html'
Then the return value should match 'Service Response' Then the return value should match 'Service Response'

View file

@ -5,9 +5,9 @@ Feature: Supports the timeout option
Scenario: A long running response Scenario: A long running response
Given a remote service that returns '<h1>Some HTML</h1>' Given a remote service that returns '<h1>Some HTML</h1>'
And that service is accessed at the path '/service.html' And that service is accessed at the path '/long_running_service.html'
And that service takes 2 seconds to generate a response And that service takes 2 seconds to generate a response
When I set my HTTParty timeout option to 1 When I set my HTTParty timeout option to 1
And I call HTTParty#get with '/service.html' And I call HTTParty#get with '/long_running_service.html'
Then it should raise a Timeout::Error exception Then it should raise a Timeout::Error exception
And I wait for the server to recover And I wait for the server to recover