Skip to content
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

[RHELDST-2414] integration tests should log response headers #109

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

lebouillon
Copy link
Collaborator

In exodus-lambda tests/integration, when a test fails because some attribute of
a response doesn't match an expected value, the test output contains all headers
on the response.

@@ -9,6 +9,7 @@ def test_exodus_basic(cdn_test_url):
)

r = requests.get(url)
print(r.headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about formatting the json in an easier way to read it.
https://www.journaldev.com/33302/python-pretty-print-json

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lioramilbaum Yes! I will give it a try.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmilbaum
lmilbaum previously approved these changes Aug 11, 2020
@lebouillon
Copy link
Collaborator Author

lebouillon commented Aug 11, 2020

@rohanpm @nathanegillett @crungehottman @lioramilbaum
The reason why I did the type casting dict(r.headers) is if it uses r.headers directly will encounter the following problem.

TypeError: Object of type CaseInsensitiveDict is not JSON serializable

and the type of r.headers is <class 'requests.structures.CaseInsensitiveDict'>.
This issue can also explain it. psf/requests#1380

rohanpm
rohanpm previously approved these changes Aug 11, 2020
Copy link
Member

@rohanpm rohanpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With respect to the commit message:

[RHELDST-2414] integration tests should log response headers

If you'll put an issue key in the commit message subject, could it please be at the end rather than the beginning?

In exodus-lambda tests/integration, when a test fails because some attribute of
a response doesn't match an expected value, the test output contains all headers
on the response.
@lebouillon
Copy link
Collaborator Author

lebouillon commented Aug 12, 2020

@rohanpm updated the commit message, please review.

@rohanpm rohanpm merged commit bc8e2c6 into release-engineering:master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants