]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2225_xfrout] update the counter object and its getter method according to the new...
authorNaoki Kambe <kambe@jprs.co.jp>
Thu, 6 Dec 2012 05:39:51 +0000 (14:39 +0900)
committerNaoki Kambe <kambe@jprs.co.jp>
Mon, 21 Jan 2013 05:27:02 +0000 (14:27 +0900)
It raises DataNotFoundError instead of zero-count on the new interface when the
getter method is invoked if its counter hasn't been incremented yet

src/lib/python/isc/notify/tests/notify_out_test.py

index d60ea2aeafc3b04558ff8a76d491d49946efbd78..b88cc9d53f3a95bfd23478dadc4a7cebd3969dd4 100644 (file)
@@ -266,8 +266,12 @@ class TestNotifyOut(unittest.TestCase):
     def test_send_notify_message_udp_ipv4(self):
         example_com_info = self._notify._notify_infos[('example.net.', 'IN')]
 
-        self.assertEqual(Counter.get_notifyoutv4('example.net.'), 0)
-        self.assertEqual(Counter.get_notifyoutv6('example.net.'), 0)
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv4')
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv6')
 
         example_com_info.prepare_notify_out()
         ret = self._notify._send_notify_message_udp(example_com_info,
@@ -282,8 +286,12 @@ class TestNotifyOut(unittest.TestCase):
     def test_send_notify_message_udp_ipv6(self):
         example_com_info = self._notify._notify_infos[('example.net.', 'IN')]
 
-        self.assertEqual(Counter.get_notifyoutv4('example.net.'), 0)
-        self.assertEqual(Counter.get_notifyoutv6('example.net.'), 0)
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv4')
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv6')
 
         ret = self._notify._send_notify_message_udp(example_com_info,
                                                     ('2001:db8::53', 53))
@@ -297,8 +305,12 @@ class TestNotifyOut(unittest.TestCase):
     def test_send_notify_message_with_bogus_address(self):
         example_com_info = self._notify._notify_infos[('example.net.', 'IN')]
 
-        self.assertEqual(Counter.get_notifyoutv4('example.net.'), 0)
-        self.assertEqual(Counter.get_notifyoutv6('example.net.'), 0)
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv4')
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv6')
 
         # As long as the underlying data source validates RDATA this shouldn't
         # happen, but right now it's not actually the case.  Even if the
@@ -308,8 +320,12 @@ class TestNotifyOut(unittest.TestCase):
                                                     ('invalid', 53))
         self.assertFalse(ret)
 
-        self.assertEqual(Counter.get_notifyoutv4('example.net.'), 0)
-        self.assertEqual(Counter.get_notifyoutv6('example.net.'), 0)
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv4')
+        self.assertRaises(isc.cc.data.DataNotFoundError,
+                          self._notify._counter.get,
+                          'zones', 'example.net.', 'notifyoutv4')
 
     def test_zone_notify_handler(self):
         old_send_msg = self._notify._send_notify_message_udp