diff options
| author | Nils Wisiol <mail@nils-wisiol.de> | 2020-06-01 16:12:28 +0200 |
|---|---|---|
| committer | Nils Wisiol <mail@nils-wisiol.de> | 2020-06-01 16:54:06 +0200 |
| commit | c9f6c8193f4812878ca971a0622d038ddb05cf44 (patch) | |
| tree | 66b10da5a4fabdc156774a36371096065e1bad8f /tests/test_bugs.py | |
| parent | 8cc4963a1a7323ec320f7cd4b02a70b8b9df04f6 (diff) | |
| download | dnspython-c9f6c8193f4812878ca971a0622d038ddb05cf44.tar.gz | |
Lowercase SRV records in to_digestable(), fixes #496
Diffstat (limited to 'tests/test_bugs.py')
| -rw-r--r-- | tests/test_bugs.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_bugs.py b/tests/test_bugs.py index 59e5f0e..e10f826 100644 --- a/tests/test_bugs.py +++ b/tests/test_bugs.py @@ -25,6 +25,8 @@ import dns.rdataclass import dns.rdatatype import dns.rdtypes.ANY.TXT import dns.ttl +from dns import rdata, rdataclass, rdatatype + class BugsTestCase(unittest.TestCase): @@ -95,5 +97,26 @@ class BugsTestCase(unittest.TestCase): self.assertEqual(t1, t2) self.assertEqual(t1, t4) + def test_lowercase_canonicals(self): + for t, presentation_format in [ + ('SRV', '100 1 5061 EXAMPLE.com.'), + # TODO also check NS, MD, MF, CNAME, SOA, MB, MG, MR, PTR, + # HINFO, MINFO, MX, HINFO, RP, AFSDB, RT, SIG, PX, NXT, + # NAPTR, KX, SRV, DNAME, A6, RRSIG, or NSEC + ]: + canonical_format = rdata.from_text( + rdclass=rdataclass.IN, + rdtype=rdatatype.from_text(t), + tok=presentation_format, + relativize=False + ).to_digestable() + self.assertIn( + b'example', + canonical_format, + f'Expected canonical format of {t} record type to have ' + f'lowercase DNS names, but saw {canonical_format}.' + ) + + if __name__ == '__main__': unittest.main() |
