How to send Authorization Details in Mock request Header or to pact verfier

92 views
Skip to first unread message

PactLearner

unread,
Aug 2, 2018, 3:14:26 AM8/2/18
to Pact Support
 
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


Beth

unread,
Aug 2, 2018, 7:18:15 PM8/2/18
to thirum...@gmail.com, Pact Support
Hi,

The people who are on this mailing list are the same as the people who you have asked in Slack. We are doing our best to help you, however, you need to provide answers to the questions we have already sent you.

Regards,
Beth


--
Pact-Support email group is being deprecated, please use StackOverflow instead to help make questions and answers more visible: http://stackoverflow.com/questions/tagged/pact
---
You received this message because you are subscribed to the Google Groups "Pact Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pact-support...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thirumala Reddy

unread,
Aug 3, 2018, 2:36:13 AM8/3/18
to bet...@gmail.com, pact-s...@googlegroups.com
Hi Beth,
my sincere apologies. i am from QA background and trying to do PACT Contract Testing POC to convience my dev team to implement it .
unable to find out the sample example in pact python so i am asking same questions repeatedly .
sorry for that , i will follow links you have mentioned and get back to you after thorough analysis from my side

--
Thanks&Regards

Thirumala  Reddy Mangalipalli

Mobile: 309 750 3170
Reply all
Reply to author
Forward
0 new messages