New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pact verifier is throwing Error (Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8) #90
Comments
Thanks. Can you please provide the output pact (JSON) file, and ideally, a minimal code base (in GitHub) that we can use to replicate your problem? |
Thanks Matt for helping out , here is JSON file
|
hi matt, |
@thiruHp as I asked repeatedly on slack, can you please identify what is in the response body by looking at the verification logs. Yes, the encoding error could be handled better by the code, however, it is being caused by the wrong response being returned by the provider. You need to fix the 403 error first. |
In response to your question on the mailing list, the authorization headers will be sent through with all the other headers. You must set up the right data on the provider using the provider states feature so that when the token is sent through, a matching user exists, so that the code returns a 200. I see no evidence that you have used any provider states in this code. |
@bethesque - Sorry , i have looked at the log file . i am able to see below error log when i verify pact using pact verfier . are you referring different log ? i have verified the real service response through browser and i can see data properly . F[ailure/Error: expect(response_status).to eql expected_response_status
Regarding Provider States : Regarding Authorization Headers [GET https: http....com/ /v1/ forms/83359274-7ad6-4 OAUTH2.0: |
OK I've taken a look. Here are a few pieces of feedback:
The problem, from what I can gather, is that you are pointing to a domain with a self-signed certificate (https://alignapi.alta-sqa1.aligntech.com/) in your provider verification, and the process is failing because of it. I could make your tests work locally by extracting the expected response and putting into your test provider, and running the verification against it. See the "pact-provider-verifier" section at https://github.com/pact-foundation/pact-ruby-standalone/releases on how to specify a custom SSL for the verifier. You will probably need to talk to a Developer/Ops person in your org to assist you in finding this certificate and setting up your environment. That being said, my suggestion is that you don't hit the live environment and hit a local one instead, thus side stepping the SSL issue. |
In answer to your authorisation details, the process would look like this, assuming you're running
|
Hi Matt,
if you dont mind can you add the code how you were able to run locally in test provider . i am still unable to solve the issue. Regarding SSL Certifcate: i have contacted team members and as per the team, for this SSL is not required since we were able to browse the service in browser to see the data . Regarding Authorization Details : i have followed your steps on other service where it is taking OAUTH Token. thank you for this, now no issue with sending token to verifier . but unfortunaley after taking token same error is coming which i have faced in current git hub code
Other question : if i am doing negative scenario test(service response says url is wrong..etc), pact verfictaion is passing since Content-Type: charset=UTF-8 in service response . when ever i am doing happy path scenario(where data will be displayed )so my guess is my issue is related to Content-Type: application/vnd.siren+json. do you have any thoughts on this ? |
Hi Matt, instead if i give like below it is working https://alignapi.alta-sqa1.aligntech.com Thank you for your time |
Sorry for my delay I've been on leave for a few days. Glad to hear it's all working! 👍 |
Hi,
can you please help me on below scenario ?
i am able to create Jason mock properly but at the time json file generation below error is coming but Json file is created successfully
Error: "AssertionError: [{'class': ['HealthCheck'], 'properties':[863 chars]'}]}] != <pact.matchers.EachLike object at 0x06C66AD0>"
using pact verifier to verify the json file but getting below error .
i am doing poc and just want to mock only some part of the response to pass the test case. can you please help me what i am doing wrong ?
Consumer.py:
Test_consumer.py :
can you please help me what i am doing wrong ?
The text was updated successfully, but these errors were encountered: