summaryrefslogtreecommitdiff
path: root/tests/test_requests.py
diff options
context:
space:
mode:
authorNate Prewitt <Nate.Prewitt@gmail.com>2018-10-28 23:17:39 -0700
committerNate Prewitt <Nate.Prewitt@gmail.com>2018-10-28 23:29:04 -0700
commitea9436a5d6a5934a906e91202349aabf9af75d15 (patch)
tree1673095262910e58b569f43f3ffed52de950b76c /tests/test_requests.py
parent7c812e919b3cd3267c2159be96ad63fff3dd1260 (diff)
downloadpython-requests-default_port_handling.tar.gz
proper handling for default ports in auth strippingdefault_port_handling
Diffstat (limited to 'tests/test_requests.py')
-rw-r--r--tests/test_requests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_requests.py b/tests/test_requests.py
index 4cf5c973..4bc1924f 100644
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -1611,6 +1611,17 @@ class TestRequests:
s = requests.Session()
assert s.should_strip_auth('http://example.com:1234/foo', 'https://example.com:4321/bar')
+ @pytest.mark.parametrize(
+ 'old_uri, new_uri', (
+ ('https://example.com:443/foo', 'https://example.com/bar'),
+ ('http://example.com:80/foo', 'http://example.com/bar'),
+ ('https://example.com/foo', 'https://example.com:443/bar'),
+ ('http://example.com/foo', 'http://example.com:80/bar')
+ ))
+ def test_should_strip_auth_default_port(self, old_uri, new_uri):
+ s = requests.Session()
+ assert not s.should_strip_auth(old_uri, new_uri)
+
def test_manual_redirect_with_partial_body_read(self, httpbin):
s = requests.Session()
r1 = s.get(httpbin('redirect/2'), allow_redirects=False, stream=True)