|
@@ -19,6 +19,7 @@
|
|
|
import unittest
|
|
|
import os
|
|
|
from isc.testutils.tsigctx_mock import MockTSIGContext
|
|
|
+from isc.testutils.ccsession_mock import MockModuleCCSession
|
|
|
from isc.cc.session import *
|
|
|
import isc.config
|
|
|
from isc.dns import *
|
|
@@ -1423,6 +1424,30 @@ class TestInitialization(unittest.TestCase):
|
|
|
xfrout.init_paths()
|
|
|
self.assertEqual(xfrout.UNIX_SOCKET_FILE, "The/Socket/File")
|
|
|
|
|
|
+class MyNotifier():
|
|
|
+ def __init__(self):
|
|
|
+ self.shutdown_called = False
|
|
|
+
|
|
|
+ def shutdown(self):
|
|
|
+ self.shutdown_called = True
|
|
|
+
|
|
|
+class MyXfroutServer(XfroutServer):
|
|
|
+ def __init__(self):
|
|
|
+ self._cc = MockModuleCCSession()
|
|
|
+ self._shutdown_event = threading.Event()
|
|
|
+ self._notifier = MyNotifier()
|
|
|
+ self._unix_socket_server = None
|
|
|
+
|
|
|
+class TestXfroutServer(unittest.TestCase):
|
|
|
+ def setUp(self):
|
|
|
+ self.xfrout_server = MyXfroutServer()
|
|
|
+
|
|
|
+ def test_shutdown(self):
|
|
|
+ self.xfrout_server.shutdown()
|
|
|
+ self.assertTrue(self.xfrout_server._notifier.shutdown_called)
|
|
|
+ self.assertTrue(self.xfrout_server._cc.stopped)
|
|
|
+
|
|
|
+
|
|
|
if __name__== "__main__":
|
|
|
isc.log.resetUnitTestRootLogger()
|
|
|
unittest.main()
|