Commit 0d222460 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #3028

Remove an old stray test command.
parents f17c3559 803bd5a3
......@@ -169,8 +169,6 @@
The configuration command is:
</para>
<!-- NOTE: print_settings is not documented since I think will be removed -->
<para>
<command>shutdown</command> exits <command>b10-cmdctl</command>.
This has an optional <varname>pid</varname> argument to
......
......@@ -370,8 +370,6 @@ class CommandControl():
self._httpserver.shutdown()
self._serving = False
elif command == 'print_settings':
answer = ccsession.create_answer(0, self._cmdctl_config_data)
else:
answer = ccsession.create_answer(1, 'unknown command: ' + command)
......
......@@ -23,11 +23,6 @@
}
],
"commands": [
{
"command_name": "print_settings",
"command_description": "Print some_string and some_int to stdout",
"command_args": []
},
{
"command_name": "shutdown",
"command_description": "shutdown cmdctl",
......
......@@ -462,10 +462,22 @@ class TestCommandControl(unittest.TestCase):
answer = self.cmdctl.command_handler('unknown-command', None)
self._check_answer(answer, 1, 'unknown command: unknown-command')
answer = self.cmdctl.command_handler('print_settings', None)
# Send a real command. Mock stuff so the shutdown command doesn't
# cause an exception.
class ModuleCC:
def send_stopping():
pass
self.cmdctl._module_cc = ModuleCC
called = []
class Server:
def shutdown():
called.append('shutdown')
self.cmdctl._httpserver = Server
answer = self.cmdctl.command_handler('shutdown', None)
rcode, msg = ccsession.parse_answer(answer)
self.assertEqual(rcode, 0)
self.assertTrue(msg != None)
self.assertIsNone(msg)
self.assertEqual(['shutdown'], called)
def test_command_handler_spec_update(self):
# Should not be present
......@@ -543,10 +555,10 @@ class TestCommandControl(unittest.TestCase):
self.assertEqual(1, rcode)
# Send a command to cmdctl itself. Should be the same effect.
rcode, value = self.cmdctl.send_command('Cmdctl', 'print_settings',
rcode, value = self.cmdctl.send_command('Cmdctl', 'shutdown',
None)
self.assertEqual(2, len(self.cmdctl.sent_messages))
self.assertEqual(({'command': ['print_settings']}, 'Cmdctl'),
self.assertEqual(({'command': ['shutdown']}, 'Cmdctl'),
self.cmdctl.sent_messages[-1])
self.assertEqual(1, rcode)
......
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