Browse Source

[2922] Test unknown command for msgq

Michal 'vorner' Vaner 12 years ago
parent
commit
e6a262a1e5
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/bin/msgq/tests/msgq_test.py

+ 9 - 0
src/bin/msgq/tests/msgq_test.py

@@ -178,6 +178,15 @@ class MsgQTest(unittest.TestCase):
         data = json.loads(msg[6 + header_len:].decode('utf-8'))
         data = json.loads(msg[6 + header_len:].decode('utf-8'))
         return (header, data)
         return (header, data)
 
 
+    def test_unknown_command(self):
+        """
+        Test the command handler returns error when the command is unknown.
+        """
+        # Fake we are running, to disable test workarounds
+        self.__msgq.running = True
+        self.assertEqual({'result': [1, "unknown command: unknown"]},
+                         self.__msgq.command_handler('unknown', {}))
+
     def test_undeliverable_errors(self):
     def test_undeliverable_errors(self):
         """
         """
         Send several packets through the MsgQ and check it generates
         Send several packets through the MsgQ and check it generates