示例#1
0
 def test_set_step_error(self, post_mock=None):
     """EnergyRecorder.set_step method (method error)."""
     self.test_load_config()
     self.assertFalse(EnergyRecorder.set_step(STEP_NAME))
     post_mock.assert_called_once_with(
         EnergyRecorder.energy_recorder_api["uri"] + "/step",
         auth=EnergyRecorder.energy_recorder_api["auth"],
         data=mock.ANY,
         headers=self.request_headers)
示例#2
0
 def test_set_step(self, post_mock=None):
     """EnergyRecorder.set_step method (regular case)."""
     self.test_load_config()
     self.assertTrue(EnergyRecorder.set_step(STEP_NAME))
     post_mock.assert_called_once_with(
         EnergyRecorder.energy_recorder_api["uri"] + "/step",
         auth=EnergyRecorder.energy_recorder_api["auth"],
         data=mock.ANY,
         headers=self.request_headers,
         timeout=EnergyRecorder.CONNECTION_TIMEOUT)
 def test_set_step_connection_error(self, conf_loader_mock=None):
     """EnergyRecorder.start test with exception during execution."""
     step_status = EnergyRecorder.set_step(STEP_NAME)
     self.assertFalse(step_status)