Commit 064dd51b authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1643] Few more tests

parent d2b5da0a
...@@ -775,6 +775,64 @@ class TestModuleCCSession(unittest.TestCase): ...@@ -775,6 +775,64 @@ class TestModuleCCSession(unittest.TestCase):
self._common_remote_module_by_name_test( self._common_remote_module_by_name_test(
self._internal_check_command_without_recvmsg_remote_module2) self._internal_check_command_without_recvmsg_remote_module2)
def _internal_remote_module_bad_config(self, function_lambda, parameter,
fill_other_messages):
fake_session = FakeModuleCCSession()
mccs = self.create_session("spec1.spec", None, None, fake_session)
function = function_lambda(mccs)
# Provide wrong config data. It should be rejected.
fill_other_messages(fake_session)
fake_session.group_sendmsg({'result': [0, {"bad_item": -1}]}, 'Spec2')
self.assertRaises(isc.config.ModuleCCSessionError,
function, parameter)
def test_remote_module_bad_config(self):
"""
Test the remote module rejects bad config data.
"""
self._common_remote_module_test(
self._internal_remote_module_bad_config)
def test_remote_module_by_name_bad_config(self):
"""
Test the remote module rejects bad config data.
"""
self._common_remote_module_by_name_test(
self._internal_remote_module_bad_config)
def _internal_remote_module_error_response(self, function_lambda,
parameter, fill_other_messages):
fake_session = FakeModuleCCSession()
mccs = self.create_session("spec1.spec", None, None, fake_session)
function = function_lambda(mccs)
# Provide wrong config data. It should be rejected.
fill_other_messages(fake_session)
fake_session.group_sendmsg({'result': [1, "An error, and I mean it!"]},
'Spec2')
self.assertRaises(isc.config.ModuleCCSessionError,
function, parameter)
def test_remote_module_bad_config(self):
"""
Test the remote module complains if there's an error response."
"""
self._common_remote_module_test(
self._internal_remote_module_error_response)
def test_remote_module_by_name_bad_config(self):
"""
Test the remote module complains if there's an error response."
"""
self._common_remote_module_by_name_test(
self._internal_remote_module_error_response)
def test_remote_module_bad_config(self):
"""
Test the remote module rejects bad config data.
"""
self._common_remote_module_by_name_test(
self._internal_remote_module_bad_config)
def test_module_name_mismatch(self): def test_module_name_mismatch(self):
fake_session = FakeModuleCCSession() fake_session = FakeModuleCCSession()
mccs = self.create_session("spec1.spec", None, None, fake_session) mccs = self.create_session("spec1.spec", None, None, fake_session)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment