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

Add support for url headers (tests) #1836

Closed
wants to merge 1 commit into from
Closed

Add support for url headers (tests) #1836

wants to merge 1 commit into from

Conversation

michalkowol
Copy link
Contributor

No description provided.

@gir-bot gir-bot added S: needs-review Needs to be reviewed and/or approved. C: snippets Related to the snippets extension. C: tests Related to testing. labels Oct 20, 2022
True
)
assert mock_urlopen.call_args.args[0]._full_url == 'https://test.com/myfile.md'
assert mock_urlopen.call_args.args[0].headers == {'User-agent': 'Mozilla/5.0', 'X-foo': 'Foo'}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1834 (comment)
I think it would be nice to have additional test to check url and headers

assert mock_urlopen.call_args.args[0]._full_url == expected_url
assert mock_urlopen.call_args.args[0].headers == expected_headers_dict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a small problem with Python 3.7 - checking...

@facelessuser
Copy link
Owner

I'm kind of indifferent about the test only because we aren't testing our logic, but testing that urllib processes the URL stuff properly. That's why we mock it, because we aren't interested in ensuring their library works (that's their job) as much as we are testing that we handle what it returns properly.

@michalkowol
Copy link
Contributor Author

I'm kind of indifferent about the test only because we aren't testing our logic, but testing that urllib processes the URL stuff properly. That's why we mock it, because we aren't interested in ensuring their library works (that's their job) as much as we are testing that we handle what it returns properly.

I think you are right! I am closing this PR! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: snippets Related to the snippets extension. C: tests Related to testing. S: needs-review Needs to be reviewed and/or approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants