Exemple #1
0
 def testIPv4Address(self):
     parsed = http.ParsedAddress(kInvalidIPv4)
     self.assertEquals(socket.AF_INET, parsed.family)
     self.assertEquals(socket.inet_pton(socket.AF_INET, kInvalidIPv4),
                       parsed.packed)
     self.assertEquals(kInvalidIPv4, parsed.ToString())
     self.assertFalse(http.ValidTunnelAddress.IPv4InRange(parsed.packed))
     self.assertFalse(http.ValidTunnelAddress(kInvalidIPv4).IsValid())
Exemple #2
0
 def testIPv6AddressOutOfRange(self):
     parsed = http.ParsedAddress(kOutOfRangeIPv6)
     self.assertEquals(socket.AF_INET6, parsed.family)
     self.assertEquals(socket.inet_pton(socket.AF_INET6, kOutOfRangeIPv6),
                       parsed.packed)
     self.assertEquals(kOutOfRangeIPv6, parsed.ToString())
     self.assertFalse(http.ValidTunnelAddress.IPv6InRange(parsed.packed))
     self.assertFalse(http.ValidTunnelAddress(kOutOfRangeIPv6).IsValid())
Exemple #3
0
 def testValidTunnelIPv6Address(self):
     parsed = http.ParsedAddress(kValidIPv6)
     self.assertEquals(socket.AF_INET6, parsed.family)
     self.assertEquals(socket.inet_pton(socket.AF_INET6, kValidIPv6),
                       parsed.packed)
     self.assertEquals(kValidIPv6, parsed.ToString())
     valid = http.ValidTunnelAddress(kValidIPv6)
     self.assertTrue(valid.IsValid())
     converted = valid.ConvertedAddress()
     self.assertEquals(socket.AF_INET, converted.family)
     self.assertEquals(kValidIPv4, converted.ToString())