Ejemplo n.º 1
0
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')
Ejemplo n.º 2
0
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'
Ejemplo n.º 3
0
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"
Ejemplo n.º 4
0
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')
Ejemplo n.º 5
0
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')
Ejemplo n.º 6
0
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")
Ejemplo n.º 7
0
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")