Example #1
0
 def test_main_unknown(self, mock_exit):
     sys.argv = ['', 'unknown']
     main()
     # Called twice (second time from fall through as exit is mocked)
     # Hence just check that is has been called with an error code of 2
     mock_exit.aasert_has_calls(call(2))
Example #2
0
 def test_main_restart(self, mock_exit, mock_restart):
     sys.argv = ['', 'restart']
     main()
     mock_restart.assert_called_once()
     mock_exit.assert_called_once_with(0)
Example #3
0
 def test_main_invalid(self, mock_exit):
     sys.argv = ['']
     main()
     mock_exit.assert_called_once_with(2)
Example #4
0
 def test_main_stop(self, mock_exit, mock_stop):
     sys.argv = ['', 'stop']
     main()
     mock_stop.assert_called_once()
     mock_exit.assert_called_once_with(0)