11import pytest
22from .get_port_from_url import get_port_from_url
3- from urllib . parse import urlparse
3+ from urllib3 . util import parse_url
44
55
66def test_get_port_from_url ():
@@ -14,14 +14,14 @@ def test_get_port_from_url():
1414
1515
1616def test_get_port_from_parsed_url ():
17- assert get_port_from_url (urlparse ("http://localhost:4000" ), True ) == 4000
18- assert get_port_from_url (urlparse ("http://localhost" ), True ) == 80
17+ assert get_port_from_url (parse_url ("http://localhost:4000" ), True ) == 4000
18+ assert get_port_from_url (parse_url ("http://localhost" ), True ) == 80
1919 assert (
20- get_port_from_url (urlparse ("https://test.com:8080/test?abc=123" ), True ) == 8080
20+ get_port_from_url (parse_url ("https://test.com:8080/test?abc=123" ), True ) == 8080
2121 )
22- assert get_port_from_url (urlparse ("https://localhost" ), True ) == 443
23- assert get_port_from_url (urlparse ("ftp://localhost" ), True ) is None
22+ assert get_port_from_url (parse_url ("https://localhost" ), True ) == 443
23+ assert get_port_from_url (parse_url ("ftp://localhost" ), True ) is None
2424 assert (
25- get_port_from_url (urlparse ("http://localhost:1337\\ u0000asd.php" ), True ) is None
25+ get_port_from_url (parse_url ("http://localhost:1337\\ u0000asd.php" ), True ) is None
2626 )
27- assert get_port_from_url (urlparse ("http://localhost:123123/asd.php" ), True ) is None
27+ assert get_port_from_url (parse_url ("http://localhost:123123/asd.php" ), True ) is None
0 commit comments