Adjust tests to compensate for --trusted-hosts

This commit is contained in:
Donald Stufft 2014-12-20 18:03:33 -05:00
parent a5f88d1815
commit 8d3de97d34
2 changed files with 14 additions and 4 deletions

View File

@ -430,6 +430,7 @@ general_group = {
default_vcs,
skip_requirements_regex,
exists_action,
trusted_host,
cert,
client_cert,
cache_dir,
@ -449,7 +450,6 @@ index_group = {
mirrors,
allow_external,
allow_all_external,
trusted_host,
no_allow_external,
allow_unsafe,
no_allow_unsafe,

View File

@ -304,10 +304,20 @@ class TestPipSession:
def test_cache_is_enabled(self, tmpdir):
session = PipSession(cache=tmpdir.join("test-cache"))
assert hasattr(session.adapters["http://"], "cache")
assert hasattr(session.adapters["https://"], "cache")
assert (session.adapters["http://"].cache.directory
== tmpdir.join("test-cache"))
assert (session.adapters["https://"].cache.directory
== tmpdir.join("test-cache"))
def test_http_cache_is_not_enabled(self, tmpdir):
session = PipSession(cache=tmpdir.join("test-cache"))
assert not hasattr(session.adapters["http://"], "cache")
def test_insecure_host_cache_is_not_enabled(self, tmpdir):
session = PipSession(
cache=tmpdir.join("test-cache"),
insecure_hosts=["example.com"],
)
assert not hasattr(session.adapters["https://example.com/"], "cache")