Skip to content

Commit

Permalink
Update proxy tests with RFC 3986 complaint URIs
Browse files Browse the repository at this point in the history
Background: urllib3 1.25 has updated urllib3.utils.parse_url() and now
requires RFC 3986 compliant URI structures to be passed to it.
  • Loading branch information
diegobz committed Dec 13, 2019
1 parent b5cb0e3 commit 9fb3bfd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_makes_request_with_proxy(self, mock_manager):

# Test http
host = 'http://whynotestsforthisstuff.com'
with patch.dict(os.environ, {'http_proxy': 'host:333'}):
with patch.dict(os.environ, {'http_proxy': 'proxy.host:333'}):
utils.make_request(
'GET',
host,
Expand All @@ -89,12 +89,12 @@ def test_makes_request_with_proxy(self, mock_manager):
)
mock_manager.assert_called_once_with(num_pools=1,
proxy_headers=Any(),
proxy_url='http://host:333')
proxy_url='http://proxy.host:333')
mock_connection.request.assert_called_once()

# Test https
host = 'https://whynotestsforthisstuff.com'
with patch.dict(os.environ, {'https_proxy': 'host:333'}):
with patch.dict(os.environ, {'https_proxy': 'proxy.host:333'}):
utils.make_request(
'GET',
host,
Expand All @@ -104,7 +104,7 @@ def test_makes_request_with_proxy(self, mock_manager):
)
mock_manager.assert_called_with(num_pools=1,
proxy_headers=Any(),
proxy_url='https://host:333',
proxy_url='https://proxy.host:333',
ca_certs=Any(),
cert_reqs=Any())
self.assertEqual(mock_connection.request.call_count, 2)
Expand Down

0 comments on commit 9fb3bfd

Please sign in to comment.