def test_parse_ipv6_address(self): """ Tests parsing of an ipv4 address into a network byte value """ address = "2607:f0d0:1002:0051:0000:0000:0000:0004" driver = WinDivert(self.dll_path).register() result = inet_ntop(socket.AF_INET6, driver.parse_ipv6_address(address)) self.assertEqual(inet_pton(socket.AF_INET6, address), inet_pton(socket.AF_INET6, result))
def test_parse_ipv4_address(self): """ Tests parsing of an ipv4 address into a network byte value """ address = "192.168.1.1" driver = WinDivert() driver.register() result = driver.parse_ipv4_address(address) self.assertEqual(struct.unpack(">I", inet_pton(socket.AF_INET, address))[0], result)
def test_parse_ipv6_address(self): """ Tests parsing of an ipv4 address into a network byte value """ address = "2607:f0d0:1002:0051:0000:0000:0000:0004" driver = WinDivert(self.dll_path) driver.register() result = driver.parse_ipv6_address(address) self.assertEqual(struct.unpack("<HHHHHHHH", inet_pton(socket.AF_INET6, address)), tuple(result))
def test_parse_ipv4_address(self): """ Tests parsing of an ipv4 address into a network byte value """ address = "192.168.1.1" driver = WinDivert() driver.register() result = driver.parse_ipv4_address(address) self.assertEqual( struct.unpack(">I", inet_pton(socket.AF_INET, address))[0], result)
def test_parse_ipv6_address(self): """ Tests parsing of an ipv4 address into a network byte value """ address = "2607:f0d0:1002:0051:0000:0000:0000:0004" driver = WinDivert(self.dll_path) driver.register() result = driver.parse_ipv6_address(address) self.assertEqual( struct.unpack("<HHHHHHHH", inet_pton(socket.AF_INET6, address)), tuple(result))