def test_parse_type_unsupported_type(self): """ Test case to parse a type of value 3, which is unsupported by dns_shark. """ a_type: str = ResourceRecord.parse_type(self.unsupported_type) self.assertEqual(a_type, '3')
def test_parse_type_aaaa_type(self): """ Test case to parse a type of value 28 (AAAA type). """ a_type: str = ResourceRecord.parse_type(self.aaaa_type) self.assertEqual(a_type, 'AAAA')
def test_parse_type_ns_type(self): """ Test case to parse a type of value 2 (NS type). """ a_type: str = ResourceRecord.parse_type(self.ns_type) self.assertEqual(a_type, 'NS')
def test_parse_type_cn_type(self): """ Test case to parse a type of value 5 (CN type). """ a_type: str = ResourceRecord.parse_type(self.cn_type) self.assertEqual(a_type, 'CN')
def print_dns_query(self, dns_server_ip: str) -> None: """ Print a dns query message. This includes printing the query id, domain name being asked for by the dns query, the type of record being asked for, and the dns server that is being queried. :param dns_server_ip: ip address of the dns server the domain name resolution request was sent to. :return: None """ print('Query ID: ' + str(self.query_id) + ' ' + self.dns_questions[0].name + ' ' + ResourceRecord.parse_type(self.dns_questions[0].type) + ' --> ' + dns_server_ip)