def test_ipv6_brackets(self): addr = "fc00:bbb9:a634:aa7d:8cb1:1c1e:d1cb:519c" resp = {"IsBimodal": True, "ActivePeerPrivateIPAddr": "[{0}]".format(addr)} _, parsed_ip = rpc.parse_is_account_bimodal_response(resp) self.assertEqual(parsed_ip, addr)
def test_ipv6_no_brackets(self): addr = "fc00:df02:c928:4ef2:f085:8af2:cf1b:6b4" resp = {"IsBimodal": True, "ActivePeerPrivateIPAddr": addr} _, parsed_ip = rpc.parse_is_account_bimodal_response(resp) self.assertEqual(parsed_ip, addr)
def test_ipv4(self): resp = {"IsBimodal": True, "ActivePeerPrivateIPAddr": "10.2.3.4"} _, parsed_ip = rpc.parse_is_account_bimodal_response(resp) self.assertEqual(parsed_ip, "10.2.3.4")