def test_invalid_hostname(self): invalid_hostname = "#invalidhostname*" with self.assertRaises(Exception): Extract.hostname_to_ip(invalid_hostname)
def test_invalid_ip(self): invalid_ip_addr = "256.0.0.1" with self.assertRaises(Exception): Extract.hostname_to_ip(invalid_ip_addr)
def test_valid_hostname(self): hostname = "localhost" self.assertEqual(Extract.hostname_to_ip(hostname), inet_aton("127.0.0.1"))
def test_valid_ip(self): ip_addr = "127.0.0.1" self.assertEqual(Extract.hostname_to_ip(ip_addr), inet_aton(ip_addr))