MCPcopy Create free account
hub / github.com/rthalley/dnspython / test_bad_tsig

Method test_bad_tsig

tests/test_message.py:599–641  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

597 dns.message.from_wire(wire)
598
599 def test_bad_tsig(self):
600 keyname = dns.name.from_text("key.")
601 # Not in additional
602 q = dns.message.Message(id=1)
603 tsig = dns.rdtypes.ANY.TSIG.TSIG(
604 dns.rdataclass.ANY,
605 dns.rdatatype.TSIG,
606 dns.tsig.HMAC_SHA256,
607 0,
608 300,
609 b"1234",
610 0,
611 0,
612 b"",
613 )
614 rrs = dns.rrset.from_rdata(keyname, 0, tsig)
615 q.answer.append(rrs)
616 wire = q.to_wire()
617 with self.assertRaises(dns.message.BadTSIG):
618 dns.message.from_wire(wire)
619 # Multiple tsigs
620 q = dns.message.Message(id=1)
621 q.additional.append(rrs)
622 q.additional.append(rrs)
623 wire = q.to_wire()
624 with self.assertRaises(dns.message.BadTSIG):
625 dns.message.from_wire(wire)
626 # Class not ANY
627 tsig = dns.rdtypes.ANY.TSIG.TSIG(
628 dns.rdataclass.IN,
629 dns.rdatatype.TSIG,
630 dns.tsig.HMAC_SHA256,
631 0,
632 300,
633 b"1234",
634 0,
635 0,
636 b"",
637 )
638 rrs = dns.rrset.from_rdata(keyname, 0, tsig)
639 wire = q.to_wire()
640 with self.assertRaises(dns.message.BadTSIG):
641 dns.message.from_wire(wire)
642
643 def test_read_no_content_message(self):
644 m = dns.message.from_text(";comment")

Callers

nothing calls this directly

Calls 2

to_wireMethod · 0.95
from_textMethod · 0.45

Tested by

no test coverage detected