Parcourir la source

[2922] Test unknown command for msgq

Michal 'vorner' Vaner il y a 12 ans
Parent
commit
e6a262a1e5
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  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'))
         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):
         """
         Send several packets through the MsgQ and check it generates