예제 #1
0
 def test_add_host_fail(self):
     api = NetworkRunner()
     assert 'test' not in api.inventory.hosts
     with self.assertRaises(AssertionError):
         api.add_host(None)
예제 #2
0
 def test_get_host_by_ansible_host(self):
     host = Host(name='test1', ansible_host='test2')
     api = NetworkRunner()
     api.add_host(host)
     ret = api.has_host('test2')
     self.assertTrue(ret)
예제 #3
0
 def test_add_host(self):
     host = Host(name='test')
     api = NetworkRunner()
     assert 'test' not in api.inventory.hosts
     api.add_host(host)
     assert 'test' in api.inventory.hosts
예제 #4
0
 def test_get_host_fail(self):
     host = Host(name='test1')
     api = NetworkRunner()
     api.add_host(host)
     ret = api.has_host('test')
     self.assertFalse(ret)