test_Controller.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import unittest
  2. import unittest.mock as mock
  3. import Core.Controller as Ctrl
  4. class TestController(unittest.TestCase):
  5. @mock.patch("builtins.print")
  6. def test_process_help(self, mock_print):
  7. Ctrl.Controller.process_help(None)
  8. self.assertTrue(mock_print.called)
  9. @mock.patch("builtins.print")
  10. def test_process_help_most_used(self, mock_print):
  11. Ctrl.Controller.process_help(["most_used"])
  12. self.assertTrue(mock_print.called)
  13. @mock.patch("builtins.print")
  14. def test_process_help_least_used(self, mock_print):
  15. Ctrl.Controller.process_help(["least_used"])
  16. self.assertTrue(mock_print.called)
  17. @mock.patch("builtins.print")
  18. def test_process_help_avg(self, mock_print):
  19. Ctrl.Controller.process_help(["avg"])
  20. self.assertTrue(mock_print.called)
  21. @mock.patch("builtins.print")
  22. def test_process_help_all(self, mock_print):
  23. Ctrl.Controller.process_help(["all"])
  24. self.assertTrue(mock_print.called)
  25. @mock.patch("builtins.print")
  26. def test_process_help_random(self, mock_print):
  27. Ctrl.Controller.process_help(["random"])
  28. self.assertTrue(mock_print.called)
  29. @mock.patch("builtins.print")
  30. def test_process_help_first(self, mock_print):
  31. Ctrl.Controller.process_help(["first"])
  32. self.assertTrue(mock_print.called)
  33. @mock.patch("builtins.print")
  34. def test_process_help_last(self, mock_print):
  35. Ctrl.Controller.process_help(["last"])
  36. self.assertTrue(mock_print.called)
  37. @mock.patch("builtins.print")
  38. def test_process_help_ipaddress(self, mock_print):
  39. Ctrl.Controller.process_help(["ipaddress"])
  40. self.assertTrue(mock_print.called)
  41. @mock.patch("builtins.print")
  42. def test_process_help_macaddress(self, mock_print):
  43. Ctrl.Controller.process_help(["macaddress"])
  44. self.assertTrue(mock_print.called)
  45. @mock.patch("builtins.print")
  46. def test_process_help_examples(self, mock_print):
  47. Ctrl.Controller.process_help(["examples"])
  48. self.assertTrue(mock_print.called)