コード例 #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)