def test_list_hosts_without_ip(self): switch.add_switch( self.user_object, ip='2887583784' ) switch.add_switch_machine( self.user_object, 2, mac='28:6e:d4:46:c4:25', port='1' ) list_hosts = switch.list_switchmachines_hosts( self.user_object ) self.assertIsNotNone(list_hosts)
def test_list_hosts_without_ip(self): switch.add_switch( ip='2887583784', user=self.user_object, ) switch.add_switch_machine( 2, mac='28:6e:d4:46:c4:25', port='1', user=self.user_object, ) list_hosts = switch.list_switchmachines_hosts(user=self.user_object) expected = {'switch_ip': '172.29.8.40'} self.assertTrue( all(item in list_hosts[0].items() for item in expected.items())) self.assertIsNotNone(list_hosts)
def test_list_hosts_ip_invalid(self): switch.add_switch( ip='2887583784', user=self.user_object, ) switch.add_switch_machine( 2, mac='28:6e:d4:46:c4:25', port='1', user=self.user_object, ) list_hosts = switch.list_switchmachines_hosts( switch_ip_int='test', user=self.user_object, ) self.assertEqual(list_hosts, [])
def test_list_hosts_ip_invalid(self): switch.add_switch( ip='2887583784', user=self.user_object, ) switch.add_switch_machine( 2, mac='28:6e:d4:46:c4:25', port='1', user=self.user_object, ) list_hosts = switch.list_switchmachines_hosts( switch_ip_int='test', user=self.user_object, ) self.assertEqual(list_hosts, [])
def test_list_hosts_with_ip_int(self): switch.add_switch( self.user_object, ip='2887583784' ) switch.add_switch_machine( self.user_object, 2, mac='28:6e:d4:46:c4:25', port='1' ) list_hosts = switch.list_switchmachines_hosts( self.user_object, switch_ip_int='2887583784' ) expected = '172.29.8.40' self.assertTrue(expected for item in list_hosts[0].items())
def test_list_hosts_without_ip(self): switch.add_switch( ip='2887583784', user=self.user_object, ) switch.add_switch_machine( 2, mac='28:6e:d4:46:c4:25', port='1', user=self.user_object, ) list_hosts = switch.list_switchmachines_hosts( user=self.user_object ) expected = {'switch_ip': '172.29.8.40'} self.assertTrue( all(item in list_hosts[0].items() for item in expected.items())) self.assertIsNotNone(list_hosts)