File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -72,17 +72,24 @@ def test_http_cache_is_not_enabled(self, tmpdir):
72
72
73
73
assert not hasattr (session .adapters ["http://" ], "cache" )
74
74
75
- def test_insecure_host_adapter (self , tmpdir ):
75
+ @pytest .mark .parametrize ("cache_trusted_hosts" , [True , False ])
76
+ def test_trusted_hosts_adapter (self , tmpdir , cache_trusted_hosts ):
76
77
session = PipSession (
77
78
cache = tmpdir .joinpath ("test-cache" ),
78
79
trusted_hosts = ["example.com" ],
80
+ cache_trusted_hosts = cache_trusted_hosts ,
79
81
)
80
82
81
83
assert "https://example.com/" in session .adapters
82
84
# Check that the "port wildcard" is present.
83
85
assert "https://example.com:" in session .adapters
84
- # Check that the cache isn't enabled.
85
- assert not hasattr (session .adapters ["https://example.com/" ], "cache" )
86
+ # Check that the cache is enabled only when
87
+ # "cache_trusted_host" is enabled.
88
+ assert (
89
+ cache_trusted_host == (
90
+ hasattr (session .adapters ["https://example.com/" ], "cache" )
91
+ )
92
+ )
86
93
87
94
def test_add_trusted_host (self ):
88
95
# Leave a gap to test how the ordering is affected.
You can’t perform that action at this time.
0 commit comments