def test_get_ip(self): ip = os_utilities.get_ip() self.assertNotEqual('127.0.0.1', ip) ipv4 = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$' ipv6 = r'^%s$' % ':'.join([r'[0-9a-f]{1,4}'] * 8) self.assertTrue(re.match(ipv4, ip) or re.match(ipv6, ip), ip)