Parcourir la source

[2439] Call the check callbacks from tests

Test they have no side effects as to the acceptance of the zone, just
log stuff.
Michal 'vorner' Vaner il y a 12 ans
Parent
commit
21a9a30e94
1 fichiers modifiés avec 13 ajouts et 0 suppressions
  1. 13 0
      src/bin/xfrin/tests/xfrin_test.py

+ 13 - 0
src/bin/xfrin/tests/xfrin_test.py

@@ -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)