can you please help me on below scenario?
i am doing poc on pact and need help on understanding the concept . do we need to call real web service call code in order to create pact files? if yes, how to create pact files for existing API code
def test_HappyPath (self):
mockurl = 'http://localhost:1234'
expected = {body:true}
pact.given (
'Given there is a valid form'
).upon_receiving (
'fetch all the info '
).with_request (
'get',
'/',headers={Authorization:'Bearer 58771381-333e-334f-9604-784'}
).will_respond_with(200, body=expected)
with pact:
result = callAPI ( mockurl )
self.assertEqual(result, expected )
def callAPI (url):
return requests.get ( url ).json()
my understanding is callAPI is real production web service call ? am i correct ? if yes, do you have any sample code to return requested response from real service. i am kind of stuck in this specific part to complete my POC on pact
Thank you in Advance