def test_power_off_not_installed(self, zboot, ipmi): instance = ZerobootIpmiHost(name="test", data=self._valid_data) with pytest.raises( StateCheckError, message= "power_off should be not be able to be called before install"): instance.power_off()
def test_power_off(self, zboot, ipmi): instance = ZerobootIpmiHost(name="test", data=self._valid_data) instance.state.set('actions', 'install', 'ok') instance.power_off() ipmi.get().power_off.assert_called_with() # check if instance power state False assert not instance.data['powerState']
def test_monitor_power_off(self): instance = ZerobootIpmiHost(name="test", data=self._valid_data) instance.state.set('actions', 'install', 'ok') instance.power_on = MagicMock() instance.power_off = MagicMock() instance.power_status = MagicMock(return_value=True) instance.data['powerState'] = False instance.monitor() # power state mismatched, power_off should have been called instance.power_on.assert_not_called() instance.power_off.assert_called_with()
def test_monitor_matching_state(self): instance = ZerobootIpmiHost(name="test", data=self._valid_data) instance.state.set('actions', 'install', 'ok') instance.power_on = MagicMock() instance.power_off = MagicMock() instance.power_status = MagicMock(return_value=True) instance.data['powerState'] = True instance.monitor() # no power calls should be make instance.power_on.assert_not_called() instance.power_off.assert_not_called()