Skip to content

Instantly share code, notes, and snippets.

@hartror
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hartror/21b26533dea3e5c89c23 to your computer and use it in GitHub Desktop.
Save hartror/21b26533dea3e5c89c23 to your computer and use it in GitHub Desktop.
Pact API Options
(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