From: Michal 'vorner' Vaner Date: Thu, 14 Feb 2013 09:02:07 +0000 (+0100) Subject: [2676] Test for rpc_call X-Git-Tag: bind10-1.1.0beta1-release~83^2~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce03b1032e086e7f2cb038068dfbbdb5eac61645;p=thirdparty%2Fkea.git [2676] Test for rpc_call Just the simplest one for now, with success --- diff --git a/src/lib/python/isc/config/tests/ccsession_test.py b/src/lib/python/isc/config/tests/ccsession_test.py index ad364accaf..cb4fc28313 100644 --- a/src/lib/python/isc/config/tests/ccsession_test.py +++ b/src/lib/python/isc/config/tests/ccsession_test.py @@ -289,6 +289,26 @@ class TestModuleCCSession(unittest.TestCase): fake_session.close() mccs.__del__() # with closed fake_session + def test_rpc_call_success(self): + """ + Test we can send an RPC (command) and get an answer. The answer is + success in this case. + """ + fake_session = FakeModuleCCSession() + mccs = self.create_session("spec1.spec", None, None, fake_session) + fake_session.message_queue = [ + ["Spec1", None, {"result": [0, {"Hello": "a"}]}, False] + ] + result = mccs.rpc_call("Spec2", "*", "test", param1="Param 1", + param2="Param 2") + self.assertEqual([ + ["Spec2", "*", {"command": ["test", { + "param1": "Param 1", + "param2": "Param 2" + }]}] + ], fake_session.message_queue) + self.assertEqual({"Hello": "a"}, result) + def my_config_handler_ok(self, new_config): return isc.config.ccsession.create_answer(0)