Commit d8c55247 authored by Naoki Kambe's avatar Naoki Kambe

[trac521]

 - added tests for "ping" and "show_processes" command into "test_command_handler"
 - set verbose to True
parent ba876505
......@@ -132,12 +132,16 @@ class TestBoB(unittest.TestCase):
(self.msg, self.group) = (msg, group)
def group_recvmsg(self, nonblock, seq): pass
bob = BoB()
bob.verbose = True
bob.cc_session = DummySession()
# a bad command
self.assertEqual(bob.command_handler(-1, None),
isc.config.ccsession.create_answer(1, "bad command"))
# "shutdown" command
self.assertEqual(bob.command_handler("shutdown", None),
isc.config.ccsession.create_answer(0))
self.assertFalse(bob.runnable)
# "sendstats" command
self.assertEqual(bob.command_handler("sendstats", None),
isc.config.ccsession.create_answer(0))
self.assertEqual(bob.cc_session.group, "Stats")
......@@ -146,6 +150,14 @@ class TestBoB(unittest.TestCase):
'set', { "stats_data": {
'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
}}))
# "ping" command
self.assertEqual(bob.command_handler("ping", None),
isc.config.ccsession.create_answer(0, "pong"))
# "show_processes" command
self.assertEqual(bob.command_handler("show_processes", None),
isc.config.ccsession.create_answer(0,
bob.get_processes()))
# an unknown command
self.assertEqual(bob.command_handler("__UNKNOWN__", None),
isc.config.ccsession.create_answer(1, "Unknown command"))
......
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