Skip to content

Commit

Permalink
Merge pull request #8957 from Habbie/lua-test-resolve
Browse files Browse the repository at this point in the history
auth LUA: add test for resolve() function
  • Loading branch information
Habbie authored Mar 31, 2020
2 parents 58302a0 + 09f4b0d commit 6a10f08
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions regression-tests.auth-py/test_LuaRecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class TestLuaRecords(AuthTest):
any IN LUA A "'192.0.2.1'"
any IN TXT "hello there"
resolve IN LUA A ";local r=resolve('localhost', 1) local t={{}} for _,v in ipairs(r) do table.insert(t, v:toString()) end return t"
""",
}
_web_rrsets = []
Expand Down Expand Up @@ -593,6 +595,22 @@ def testANY(self):
self.assertRcodeEqual(res, dns.rcode.NOERROR)
self.assertEqual(self.sortRRsets(res.answer), self.sortRRsets(response.answer))

def testResolve(self):
"""
Test resolve() function
"""
name = 'resolve.example.org.'

query = dns.message.make_query(name, 'A')

response = dns.message.make_response(query)

response.answer.append(dns.rrset.from_text(name, 0, dns.rdataclass.IN, dns.rdatatype.A, '127.0.0.1'))

res = self.sendUDPQuery(query)
self.assertRcodeEqual(res, dns.rcode.NOERROR)
self.assertEqual(res.answer, response.answer)

if __name__ == '__main__':
unittest.main()
exit(0)

0 comments on commit 6a10f08

Please sign in to comment.