def setUp(self):
super(PactSetupTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_requests = patch('requests.api.request').start()
self.target = Pact(self.consumer, self.provider)
(self.target
.given('I am creating a new pact using the Pact class')
.upon_receiving('a specific request to the server')
.with_request('GET', '/path')
.will_respond_with(200, body='success'))
self.delete_call = call('delete', 'http://localhost:1234/interactions',
headers={'X-Pact-Mock-Service': 'true'})
self.put_interactions_call = call(
'put', 'http://localhost:1234/interactions',
data=None,
headers={'X-Pact-Mock-Service': 'true'},
json={'interactions': [{
'response': {'status': 200, 'body': 'success'},
'request': {'path': '/path', 'method': 'GET'},
'description': 'a specific request to the server',
'provider_state': 'I am creating a new pact using the '
'Pact class'}]})
评论列表
文章目录