]>
git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.recursor-dnssec/test_TrustAnchors.py
2 from recursortests
import RecursorTest
5 class testTrustAnchorsEnabled(RecursorTest
):
6 """This test will do a query for "trustanchor.server CH TXT" and hopes to get
10 _confdir
= 'TrustAnchorsEnabled'
13 _config_template
= """
14 allow-trust-anchor-query=yes
16 _lua_config_file
= """
17 addDS("powerdns.com", "44030 8 1 B763646757DF621DD1204AD3BFA0675B49BE3279")
19 addNTA("example.com", "some reason")
22 def testTrustanchorDotServer(self
):
23 expected
= dns
.rrset
.from_text_list(
24 'trustanchor.server.', 86400, dns
.rdataclass
.CH
, 'TXT',
25 ['". 20326"', '"powerdns.com. 44030"'])
26 query
= dns
.message
.make_query('trustanchor.server', 'TXT',
28 result
= self
.sendUDPQuery(query
)
30 self
.assertRcodeEqual(result
, dns
.rcode
.NOERROR
)
31 self
.assertRRsetInAnswer(result
, expected
)
33 def testNegativerustanchorDotServer(self
):
34 expected
= dns
.rrset
.from_text_list(
35 'negativetrustanchor.server.', 86400, dns
.rdataclass
.CH
, 'TXT',
36 ['"example."', '"example.com. some reason"'])
37 query
= dns
.message
.make_query('negativetrustanchor.server', 'TXT',
39 result
= self
.sendUDPQuery(query
)
41 self
.assertRcodeEqual(result
, dns
.rcode
.NOERROR
)
42 self
.assertRRsetInAnswer(result
, expected
)
45 class testTrustAnchorsDisabled(RecursorTest
):
46 """This test will do a query for "trustanchor.server CH TXT" and hopes to get
50 _confdir
= 'TrustAnchorsDisabled'
53 _config_template
= """
56 def testTrustanchorDotServer(self
):
57 query
= dns
.message
.make_query('trustanchor.server', 'TXT',
59 result
= self
.sendUDPQuery(query
)
61 self
.assertRcodeEqual(result
, dns
.rcode
.SERVFAIL
)
63 def testNegativerustanchorDotServer(self
):
64 query
= dns
.message
.make_query('negativetrustanchor.server', 'TXT',
66 result
= self
.sendUDPQuery(query
)
68 self
.assertRcodeEqual(result
, dns
.rcode
.SERVFAIL
)