|
@@ -114,38 +114,48 @@ class TestNotifyOut(unittest.TestCase):
|
|
|
notify_out._MAX_NOTIFY_NUM = 2
|
|
|
|
|
|
self._notify._nonblock_event.clear()
|
|
|
- self._notify.send_notify('example.net')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.net'))
|
|
|
self.assertTrue(self._notify._nonblock_event.isSet())
|
|
|
self.assertEqual(self._notify.notify_num, 1)
|
|
|
self.assertEqual(self._notify._notifying_zones[0], ('example.net.', 'IN'))
|
|
|
|
|
|
- self._notify.send_notify('example.com')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.com'))
|
|
|
self.assertEqual(self._notify.notify_num, 2)
|
|
|
self.assertEqual(self._notify._notifying_zones[1], ('example.com.', 'IN'))
|
|
|
|
|
|
# notify_num is equal to MAX_NOTIFY_NUM, append it to waiting_zones list.
|
|
|
self._notify._nonblock_event.clear()
|
|
|
- self._notify.send_notify('example.com', 'CH')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.com', 'CH'))
|
|
|
# add waiting zones won't set nonblock_event.
|
|
|
self.assertFalse(self._notify._nonblock_event.isSet())
|
|
|
self.assertEqual(self._notify.notify_num, 2)
|
|
|
self.assertEqual(1, len(self._notify._waiting_zones))
|
|
|
|
|
|
# zone_id is already in notifying_zones list, append it to waiting_zones list.
|
|
|
- self._notify.send_notify('example.net')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.net'))
|
|
|
self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
self.assertEqual(self._notify._waiting_zones[1], ('example.net.', 'IN'))
|
|
|
|
|
|
# zone_id is already in waiting_zones list, skip it.
|
|
|
- self._notify.send_notify('example.net')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.net'))
|
|
|
self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
|
|
|
# has no slave masters, skip it.
|
|
|
- self._notify.send_notify('example.org.', 'CH')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.org.', 'CH'))
|
|
|
self.assertEqual(self._notify.notify_num, 2)
|
|
|
self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
|
|
|
- self._notify.send_notify('example.org.')
|
|
|
+ self.assertTrue(self._notify.send_notify('example.org.'))
|
|
|
+ self.assertEqual(self._notify.notify_num, 2)
|
|
|
+ self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
+
|
|
|
+ # zone does not exist, should return False, and no change in other
|
|
|
+ # values
|
|
|
+ self.assertFalse(self._notify.send_notify('does.not.exist.'))
|
|
|
+ self.assertEqual(self._notify.notify_num, 2)
|
|
|
+ self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
+
|
|
|
+ self.assertFalse(self._notify.send_notify('example.net.', 'CH'))
|
|
|
self.assertEqual(self._notify.notify_num, 2)
|
|
|
self.assertEqual(2, len(self._notify._waiting_zones))
|
|
|
|