@@ -35,6 +35,16 @@ def test_get_netrc_auth():
35
35
netrc_file = test_env .get_test_loc ("test.netrc" )
36
36
parsed_netrc = netrc (netrc_file )
37
37
assert get_netrc_auth (url = "https://pyp1.org/simple" , netrc = parsed_netrc ) == ("test" , "test123" )
38
+ assert get_netrc_auth (url = "https://pyp1.org/different/path" , netrc = parsed_netrc ) == ("test" , "test123" )
39
+ assert get_netrc_auth (url = "https://pyp1.org" , netrc = parsed_netrc ) == ("test" , "test123" )
40
+
41
+
42
+ def test_get_netrc_auth_with_ports_and_schemes ():
43
+ netrc_file = test_env .get_test_loc ("test.netrc" )
44
+ parsed_netrc = netrc (netrc_file )
45
+
46
+ assert get_netrc_auth (url = "https://pyp1.org:443/path" , netrc = parsed_netrc ) == ("test" , "test123" )
47
+ assert get_netrc_auth (url = "http://pyp1.org:80/simple" , netrc = parsed_netrc ) == ("test" , "test123" )
38
48
39
49
40
50
def test_get_commented_netrc_auth ():
@@ -49,6 +59,14 @@ def test_get_netrc_auth_with_no_matching_url():
49
59
assert get_netrc_auth (url = "https://pypi2.org/simple" , netrc = parsed_netrc ) == (None , None )
50
60
51
61
62
+ def test_get_netrc_auth_with_with_subdomains ():
63
+ netrc_file = test_env .get_test_loc ("test.netrc" )
64
+ parsed_netrc = netrc (netrc_file )
65
+
66
+ assert get_netrc_auth (url = "https://subdomain.example.com/simple" , netrc = parsed_netrc ) == ("subdomain-user" , "subdomain-secret" )
67
+ assert get_netrc_auth (url = "https://another.example.com/simple" , netrc = parsed_netrc ) == (None , None )
68
+
69
+
52
70
@pytest .mark .asyncio
53
71
@pytest .mark .skipif (sys .version_info < (3 , 8 ), reason = "requires python3.8 or higher" )
54
72
@mock .patch ("python_inspector.utils_pypi.CACHE.get" )
0 commit comments