def test__power_status_off(self, ipmi_mock): ipmicmd = ipmi_mock.return_value ipmicmd.get_power.return_value = {'powerstate': 'off'} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(states.POWER_OFF, state)
def test__power_status_error(self, ipmi_mock): ipmicmd = ipmi_mock.return_value ipmicmd.get_power.return_value = {'powerstate': 'Error'} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(states.ERROR, state)
def test__power_status_error(self): ipmicmd = self.ipmi_mock.return_value ipmicmd.get_power.return_value = {'powerstate': 'Error'} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(state, states.ERROR)
def test__power_status_off(self): ipmicmd = self.ipmi_mock.return_value ipmicmd.get_power.return_value = {'powerstate': 'off'} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(state, states.POWER_OFF)
def test__power_status_error(self): ipmicmd = self.ipmi_mock.return_value ipmicmd.get_power.return_value = {"powerstate": "Error"} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(state, states.ERROR)
def test__power_status_off(self): ipmicmd = self.ipmi_mock.return_value ipmicmd.get_power.return_value = {"powerstate": "off"} state = ipminative._power_status(self.info) ipmicmd.get_power.assert_called_once_with() self.assertEqual(state, states.POWER_OFF)
def test__power_status(self): state = ipminative._power_status(self.info).strip().split()[-1] target_state = ipminative._power_status(self.info).strip().split()[-1] print target_state self.assertEqual(target_state, state)