Sfoglia il codice sorgente

Added new test for Controller.process_help()

Stefan Schmidt 6 anni fa
parent
commit
2a71007601
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      code/Test/test_Controller.py

+ 8 - 0
code/Test/test_Controller.py

@@ -58,3 +58,11 @@ class TestController(unittest.TestCase):
     def test_process_help_examples(self, mock_print):
         Ctrl.Controller.process_help(["examples"])
         self.assertTrue(mock_print.called)
+
+    @mock.patch("builtins.print")
+    def test_process_help_invalid(self, mock_print):
+        Ctrl.Controller.process_help(["invalid_keyword"])
+        self.assertTrue(mock_print.called)
+        self.assertEqual(mock_print.call_count, 2)
+        self.assertEqual(mock_print.call_args_list[0][0][0],
+                         "Unknown keyword 'invalid_keyword', try 'help;' to get a list of allowed keywords'")