Last active
August 29, 2015 14:20
-
-
Save hartror/21b26533dea3e5c89c23 to your computer and use it in GitHub Desktop.
Pact API Options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mock_service | |
.given("something exists") | |
.upon_receiving("a request for something") | |
.with_request(method="get", path="/something") | |
.will_respond_with( | |
status=200, | |
headers={'Content=Type': 'application/json'}, | |
body={'name': 'A small something'})) | |
mock_service( | |
given="something exists", | |
upon_receiving="a request for something", | |
with_request=mock_service.Request(method="get", path="/something"), | |
will_respond_with=mock_service.Response( | |
status=200, | |
headers={'Content=Type': 'application/json'}, | |
body={'name': 'A small something'})) | |
(mock_service | |
.state("something exists") | |
.description("a request for something") | |
.request(method="get", path="/something") | |
.response( | |
status=200, | |
headers={'Content=Type': 'application/json'}, | |
body={'name': 'A small something'})) | |
class GetInteraction(Interaction): | |
""" | |
Declarative approach | |
""" | |
description = "a request for something" | |
state = "something exists" | |
request = Request(method="get", path="/something") | |
response = Response( | |
status=200, | |
headers={'Content=Type': 'application/json'}, | |
body={'name': 'A small something'})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment