Esempio n. 1
0
def test_define_role_current():
    host = troops.hostname()
    assert host != 'notyou.example.com'
    troops.define_role(
        'good',
        hosts=[
            host,
            'notyou.example.com',
            ],
        )
    troops.define_role(
        'bad',
        hosts=[
            'notyou.example.com',
            ],
        )
    eq(
        sorted(troops.all_roles.keys()),
        sorted(['good', 'bad']),
        )
    eq(
        troops.all_roles['good'],
        set([
                host,
                'notyou.example.com',
                ]),
        )
    eq(
        troops.all_roles['bad'],
        set([
                'notyou.example.com',
                ]),
        )
    eq(troops.roles, set(['good']))
Esempio n. 2
0
def setup():
    # if this triggers, you're being silly and may suffer unit test
    # failures because of that
    assert not troops.hostname().endswith('.example.com')
Esempio n. 3
0
def test_hostname():
    h = troops.hostname()
    # this is totally insufficient but i don't want to start regexp
    # matching arbitrary hostnames
    assert isinstance(h, str)