def test_remove_no_host_anymore(self):
     groupa = Group('groupa')
     hosta = Host('a')
     groupa.add_host(hosta)
     assert groupa.hosts[0].name == 'a'
     groupa.del_host(hosta)
     groupa.del_host(hosta)
 def test_remove_host(self):
     groupa = Group('groupa')
     hosta = Host('a')
     groupa.add_host(hosta)
     assert groupa.hosts[0].name == 'a'
     groupa.del_host(hosta)
     assert len(groupa.hosts) == 0
 def test_has_host(self):
     g1, h1 = Group('g1'), Host('h1')
     g1.add_host(h1)
     assert g1.has_host(u'h1')
     assert g1.has_host('h1')
     assert not g1.has_host('u2')
 def test_add_host(self):
     groupa = Group('groupa')
     hosta = Host('a')
     groupa.add_host(hosta)
     assert groupa.hosts[0].name == 'a'
 def test_add_invalid_host(self):
     groupa = Group('groupa')
     with pytest.raises(TypeError):
         groupa.add_host('a')