def test_02_has_attributes(self): m1 = Machine("noResolver", "id1", hostname="gandalf", ip="1.2.3.4") m2 = Machine( "noResolver", "id2", hostname=["gandalf", "borodin"], ip=[netaddr.IPAddress("1.2.3.4"), netaddr.IPAddress("2.3.4.5")]) self.assertTrue(m1.has_hostname("gandalf")) self.assertTrue(m2.has_hostname("gandalf")) self.assertTrue(m1.has_ip("1.2.3.4")) self.assertTrue(m2.has_ip("1.2.3.4"))
def test_02_has_attributes(self): m1 = Machine("noResolver", "id1", hostname="gandalf", ip="1.2.3.4") m2 = Machine("noResolver", "id2", hostname=["gandalf", "borodin"], ip=[netaddr.IPAddress("1.2.3.4"), netaddr.IPAddress( "2.3.4.5")]) self.assertTrue(m1.has_hostname("gandalf")) self.assertTrue(m2.has_hostname("gandalf")) self.assertTrue(m1.has_ip("1.2.3.4")) self.assertTrue(m2.has_ip("1.2.3.4"))
def test_01_create_machine(self): m = Machine("noResolver", "id1", ip="1.2.3.4") self.assertEqual(m.ip, netaddr.IPAddress("1.2.3.4")) m = Machine("noResolver", "id2", ip=netaddr.IPAddress("1.2.3.4")) self.assertEqual(m.ip, netaddr.IPAddress("1.2.3.4"))