def test_decode_rdata_a_type(self): """ Test case to decode rdata of type a (ipv4). """ rdata: BytesIO = BytesIO(self.ipv4_address_data) copy: BytesIO = BytesIO(self.ipv4_address_data) ipv4_address: str = ResourceRecord._decode_rdata(rdata, copy, self.a_type) self.assertEqual(ipv4_address, '16.8.32.2')
def test_decode_rdata_aaaa_type(self): """ Test case to decode rdata of type aaaa (ipv6). """ rdata: BytesIO = BytesIO(self.ipv6_address_data) copy: BytesIO = BytesIO(self.ipv6_address_data) ipv6_address: str = ResourceRecord._decode_rdata(rdata, copy, self.aaaa_type) self.assertEqual(ipv6_address, '1008:2002:1008:2002:1008:2002:1008:2002')
def test_decode_rdata_unsupported_type(self): """ Test case to decode rdata of an unsupported type. """ rdata: BytesIO = BytesIO(self.ipv6_address_data) copy: BytesIO = BytesIO(self.ipv6_address_data) ipv6_address: str = ResourceRecord._decode_rdata(rdata, copy, self.unsupported_type) self.assertEqual(ipv6_address, 'UNSUPPORTED RESOURCE RECORD TYPE')
def test_decode_rdata_cn_type(self): """ Test case to decode rdata of type cn (name server). """ rdata: BytesIO = BytesIO(self.simple_domain_name_encoded) copy: BytesIO = BytesIO(self.simple_domain_name_encoded) decoded_domain_name: str = ResourceRecord._decode_rdata(rdata, copy, self.cn_type) self.assertEqual(decoded_domain_name, self.simple_domain_name)