def test__power_control_seamicro15k_ipmi_calls_call_and_check(self): ip, username, password, server_id, _ = self.make_context() power_change = choice(["on", "off"]) seamicro_power_driver = SeaMicroPowerDriver() call_and_check_mock = self.patch(seamicro_module, "call_and_check") seamicro_power_driver._power_control_seamicro15k_ipmi( ip, username, password, server_id, power_change) power_mode = 1 if power_change == "on" else 6 self.assertThat( call_and_check_mock, MockCalledOnceWith([ "ipmitool", "-I", "lanplus", "-H", ip, "-U", username, "-P", password, "raw", "0x2E", "1", "0x00", "0x7d", "0xab", power_mode, "0", server_id, ]), )
def test__power_control_seamicro15k_ipmi_calls_call_and_check(self): ip, username, password, server_id, _ = self.make_context() power_change = choice(['on', 'off']) seamicro_power_driver = SeaMicroPowerDriver() call_and_check_mock = self.patch(seamicro_module, 'call_and_check') seamicro_power_driver._power_control_seamicro15k_ipmi( ip, username, password, server_id, power_change) power_mode = 1 if power_change == 'on' else 6 self.assertThat( call_and_check_mock, MockCalledOnceWith([ 'ipmitool', '-I', 'lanplus', '-H', ip, '-U', username, '-P', password, 'raw', '0x2E', '1', '0x00', '0x7d', '0xab', power_mode, '0', server_id, ]))