how to send authorization details in MOCK service or to pact verfier in PACT PYTHON
when i call API thorugh soapUI it is working fine but when i run it mock Json through Pact verfier , it is faling since i am not senidng Authorization details in request header or not adding in pact verfier.
can u please help me how can send authorization details through request headers in PACT python?
def test_callMiniMalRX_HappyPath (self):
mockurl = 'http://localhost:1234'
expected = {body:true}
pact.given (
'Given there is a valid existing rx form'
).upon_receiving (
'fetch all the associated protocol ids, versions & Operations available'
).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 )
Request:
GET https: http....com/ /v1/ forms/83359274-7ad6-4
Accept-Encoding: gzip,deflate
Authorization: Bearer 58771381-333e-334f-9604-ebf977ed7784
Content-Length: 0
Host: company.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_162)
OAUTH2.0:
CSClientUser=username
CSClientPassword=pwd
CSClientIdendification=xxxx
CSClientSecret=fffff
CSAccessTokenURI=company.com/oauth2/token