def test_normalize_hostname_regression_11156(): # The issue here was that we used "rstrip" which works on characters, # not substrings. Having the domain (example.com) start with an eee # causes the hostname to get stripped of it's "eee"s ending in an # empty hostname accidentally. e = Environment('name') e.hosts['eee.example.com'] = host = Mock() e.host_domain = 'example.com' assert host == e.get_host('eee')
def test_load_ignores_predefined_environment_settings(sample_service): e = Environment('test-with-env-config') e.service_user = '******' e.host_domain = 'sample.com' e.branch = 'default' e.load() assert e.service_user == 'bob' assert e.host_domain == 'sample.com' assert e.branch == 'default'
def test_load_ignores_predefined_environment_settings(sample_service): e = Environment("test-with-env-config") e.service_user = "******" e.host_domain = "sample.com" e.branch = "default" e.load() assert e.service_user == "bob" assert e.host_domain == "sample.com" assert e.branch == "default"
def test_get_host_without_subdomain_also_works(): e = Environment('name') e.hosts['example.com'] = host = Mock() e.host_domain = 'example.com' assert host == e.get_host('example.com')
def test_get_host_normalizes_hostname(): e = Environment('name') e.hosts['asdf.example.com'] = host = Mock() e.host_domain = 'example.com' assert host == e.get_host('asdf') assert host == e.get_host('asdf.example.com')
def test_get_host_without_subdomain_also_works(): e = Environment("name") e.hosts["example.com"] = host = Mock() e.host_domain = "example.com" assert host == e.get_host("example.com")
def test_get_host_normalizes_hostname(): e = Environment("name") e.hosts["asdf.example.com"] = host = Mock() e.host_domain = "example.com" assert host == e.get_host("asdf") assert host == e.get_host("asdf.example.com")