aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/mitmproxy/net/http/test_url.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/mitmproxy/net/http/test_url.py b/test/mitmproxy/net/http/test_url.py
index 94b2eacc..5f85112b 100644
--- a/test/mitmproxy/net/http/test_url.py
+++ b/test/mitmproxy/net/http/test_url.py
@@ -1,3 +1,6 @@
+import pytest
+import sys
+
from mitmproxy.test import tutils
from mitmproxy.net.http import url
@@ -42,14 +45,18 @@ def test_parse():
# Null byte in host
with tutils.raises(ValueError):
url.parse("http://foo\0")
- # Port out of range
- _, _, port, _ = url.parse("http://foo:999999")
- assert port == 80
# Invalid IPv6 URL - see http://www.ietf.org/rfc/rfc2732.txt
with tutils.raises(ValueError):
url.parse('http://lo[calhost')
+@pytest.mark.skipif(sys.version_info < (3, 6), reason='requires Python 3.6 or higher')
+def test_parse_port_range():
+ # Port out of range
+ with tutils.raises(ValueError):
+ url.parse("http://foo:999999")
+
+
def test_unparse():
assert url.unparse("http", "foo.com", 99, "") == "http://foo.com:99"
assert url.unparse("http", "foo.com", 80, "/bar") == "http://foo.com/bar"