def test_parse_ns_question(self): expected = DnsPacket(id_=2, is_authoritative=False, is_response=False, opcode=0, is_truncated=False, is_recursion_desired=True, is_recursion_available=False, question=(b'e1.ru', QueryType.NS), answers=(), has_error=False) self._test_packet(expected, 1)
def test_parse_ptr_question(self): expected = DnsPacket(id_=1, is_authoritative=False, is_response=False, opcode=0, is_truncated=False, is_recursion_desired=True, is_recursion_available=False, question=(b'1.1.168.192.in-addr.arpa', QueryType.PTR), answers=(), has_error=False) self._test_packet(expected, 0)
def test_parse_ns_answers(self): answers = [(b'e1.ru', QueryType.NS, 300, b'\x03ns2\x03ngs\xc0\x0f'), (b'e1.ru', QueryType.NS, 300, b"\x02ns\xc0'"), (b'e1.ru', QueryType.NS, 300, b'\x03ns1\xc0\x0c'), (b'e1.ru', QueryType.NS, 300, b'\x03ns2\xc0\x0c')] expected = DnsPacket(id_=2, is_authoritative=False, is_response=True, opcode=0, is_truncated=False, is_recursion_available=True, is_recursion_desired=True, question=(b'e1.ru', QueryType.NS), answers=tuple(answers), has_error=False) self._test_packet(expected, 2)