예제 #1
0
파일: test_booth.py 프로젝트: gmelikov/pcs
 def test_success(self, mock_start, mock_is_systemctl):
     commands.start_booth(self.mock_env)
     mock_start.assert_called_once_with(self.mock_run, "booth", self.name)
     mock_is_systemctl.assert_called_once_with()
     assert_report_item_list_equal(
         self.mock_rep.report_item_list,
         [(Severities.INFO, report_codes.SERVICE_START_SUCCESS, {
             "service": "booth",
             "node": None,
             "instance": self.name,
         })])
예제 #2
0
 def test_success(self, mock_start, mock_is_systemctl):
     commands.start_booth(self.mock_env, "name")
     mock_start.assert_called_once_with(self.mock_run, "booth", "name")
     mock_is_systemctl.assert_called_once_with()
     assert_report_item_list_equal(
         self.mock_rep.report_item_list,
         [(
             Severities.INFO,
             report_codes.SERVICE_START_SUCCESS,
             {
                 "service": "booth",
                 "node": None,
                 "instance": "name",
             }
         )]
     )
예제 #3
0
파일: test_booth.py 프로젝트: gmelikov/pcs
 def test_failed(self, mock_start, mock_is_systemctl):
     mock_start.side_effect = StartServiceError("booth", "msg", self.name)
     assert_raise_library_error(
         lambda: commands.start_booth(self.mock_env),
         (Severities.ERROR, report_codes.SERVICE_START_ERROR, {
             "service": "booth",
             "reason": "msg",
             "node": None,
             "instance": self.name,
         }))
     mock_start.assert_called_once_with(self.mock_run, "booth", self.name)
     mock_is_systemctl.assert_called_once_with()
예제 #4
0
 def test_failed(self, mock_start, mock_is_systemctl):
     mock_start.side_effect = StartServiceError("booth", "msg", "name")
     assert_raise_library_error(
         lambda: commands.start_booth(self.mock_env, "name"),
         (
             Severities.ERROR,
             report_codes.SERVICE_START_ERROR,
             {
                 "service": "booth",
                 "reason": "msg",
                 "node": None,
                 "instance": "name",
             }
         )
     )
     mock_start.assert_called_once_with(self.mock_run, "booth", "name")
     mock_is_systemctl.assert_called_once_with()