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

bpo-29799 Adding tests for HTTP header API of urllib.request.Request class #643

Conversation

ultimatecoder
Copy link
Contributor

@mention-bot
Copy link

@ultimatecoder, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @orsenthil, @birkenfeld, @benjaminp and @serhiy-storchaka to be potential reviewers.

def test_request_with_headers(self):
"""Verify headers if passed as a constructor argument."""
request = self.Request("http://www.python.org", headers=self.headers)
self.assertDictEqual(request.headers, self.headers)
Copy link
Member

Choose a reason for hiding this comment

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

Redundant with test_urllib2.RequestHdrsTests.test_request_headers_dict

"""Verify presence of headers is marked."""
request = self.Request("http://www.python.org", headers=self.headers)
self.assertTrue(request.has_header('User-agent'))
self.assertFalse(request.has_header('Content-type'))
Copy link
Member

Choose a reason for hiding this comment

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

Test_urllib2.RequestHdrsTests.test_request_headers_methods already tests “has_header” against a constructor-supplied header field, and also has a negative test.

self.assertListEqual(
request.header_items(),
list(self.headers.items())
)
Copy link
Member

Choose a reason for hiding this comment

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

Also covered by “test_request_headers_methods”

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.

None yet

4 participants