Commit 21a9a30e authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2439] Call the check callbacks from tests

Test they have no side effects as to the acceptance of the zone, just
log stuff.
parent f7c0e1bf
......@@ -754,6 +754,10 @@ class TestXfrinConnection(unittest.TestCase):
A mock function used instead of dns.check_zone.
'''
self._check_zone_params = (name, rrclass, rrsets, callbacks)
# Call both callbacks to see they do nothing. This checks
# the transfer depends on the result only.
callbacks[0]("Test error")
callbacks[1]("Test warning")
return self._check_zone_result
def _create_normal_response_data(self):
......@@ -1551,6 +1555,15 @@ class TestAXFR(TestXfrinConnection):
self.conn.response_generator = self._create_normal_response_data
self.assertEqual(self.conn.do_xfrin(False), XFRIN_FAIL)
def test_do_xfrin_invalid_zone(self):
"""
Test receiving an invalid zone. We mock the check and see the whole
transfer is rejected.
"""
self._check_zone_result = False
self.conn.response_generator = self._create_normal_response_data
self.assertEqual(self.conn.do_xfrin(False), XFRIN_FAIL)
def test_do_soacheck_and_xfrin(self):
self.conn.response_generator = self._create_soa_response_data
self.assertEqual(self.conn.do_xfrin(True), XFRIN_OK)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment