]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2353] Test BoB.start_ccsession()
authorMukund Sivaraman <muks@isc.org>
Sun, 18 Nov 2012 22:50:44 +0000 (04:20 +0530)
committerMukund Sivaraman <muks@isc.org>
Sun, 18 Nov 2012 22:50:44 +0000 (04:20 +0530)
src/bin/bind10/bind10_src.py.in
src/bin/bind10/tests/bind10_test.py.in

index 6d64c305c560581410a81e4579913e8592d86930..cfdbf9008e65e487db69aa68eec30590bedde8d5 100755 (executable)
@@ -503,6 +503,8 @@ class BoB:
         self.ccs.start()
         logger.debug(DBG_PROCESS, BIND10_STARTED_CC)
 
+        return self.ccs
+
     # A couple of utility methods for starting processes...
 
     def start_process(self, name, args, c_channel_env, port=None, address=None):
index 367f8dda81aafbda552cf4d2f4add139b2c8ca60..a417210d4496b9ae3f0cf30ac88e0e17e62f9112 100644 (file)
@@ -1651,6 +1651,31 @@ class TestBossComponents(unittest.TestCase):
         # this is set by ProcessInfo.spawn()
         self.assertEqual(42147, pi.pid)
 
+    def test_start_ccsession(self):
+        '''Test that CC session is started.'''
+        class DummySession():
+            def __init__(self, specfile, config_handler, command_handler,
+                         socket_file):
+                self.specfile = specfile
+                self.config_handler = config_handler
+                self.command_handler = command_handler
+                self.socket_file = socket_file
+                self.started = False
+            def start(self):
+                self.started = True
+        bob = MockBobSimple()
+        tmp = isc.config.ModuleCCSession
+        isc.config.ModuleCCSession = DummySession
+
+        ccs = bob.start_ccsession({})
+        self.assertEqual(bind10_src.SPECFILE_LOCATION, ccs.specfile)
+        self.assertEqual(bob.config_handler, ccs.config_handler)
+        self.assertEqual(bob.command_handler, ccs.command_handler)
+        self.assertEqual(bob.msgq_socket_file, ccs.socket_file)
+        self.assertTrue(ccs.started)
+
+        isc.config.ModuleCCSession = tmp
+
     def test_start_process(self):
         '''Test that processes can be started.'''
         bob = MockBob()