existing_cls = get_rdata_class(rdclass, rdtype)
if existing_cls != GenericRdata or dns.rdatatype.is_metatype(rdtype):
raise RdatatypeExists(rdclass=rdclass, rdtype=rdtype)
- try:
- if (
- rdtype in dns.rdatatype.RdataType
- and dns.rdatatype.RdataType(rdtype).name != rdtype_text
- ):
- raise RdatatypeExists(rdclass=rdclass, rdtype=rdtype)
- except ValueError:
- pass
_rdata_classes[(rdclass, rdtype)] = getattr(
implementation, rdtype_text.replace("-", "_")
)
rd = dns.rdata.from_text("in", "rrsig", text)
self.assertEqual(repr(rd), "<DNS IN RRSIG(NSEC) rdata: " + text + ">")
- def test_bad_registration_implementing_known_type_with_wrong_name(self):
- # Try to register an implementation at the MG codepoint that isn't
- # called "MG"
+ def test_registration_implementing_known_and_implemented_type(self):
+ # Try to register an implementation at the A codepoint.
with self.assertRaises(dns.rdata.RdatatypeExists):
- dns.rdata.register_type(None, dns.rdatatype.MG, "NOTMG")
+ dns.rdata.register_type(None, dns.rdatatype.A, "ANYTHING")
- def test_registration_implementing_known_type_with_right_name(self):
+ def test_registration_of_known_but_unimplmented_type(self):
# Try to register an implementation at the MD codepoint
dns.rdata.register_type(tests.md_module, dns.rdatatype.MD, "MD")
rd = dns.rdata.from_text("in", "md", "foo.")