def test__issue_amttool_command_calls__run(self): amt_power_driver = AMTPowerDriver() ip_address = factory.make_ipv4_address() power_pass = factory.make_name('power_pass') amttool_boot_mode = factory.make_name('amttool_boot_mode') stdin = factory.make_name('stdin').encode('utf-8') cmd = choice(['power-cycle', 'powerup']) command = 'amttool', ip_address, cmd, amttool_boot_mode _run_mock = self.patch(amt_power_driver, '_run') _run_mock.return_value = b'output' result = amt_power_driver._issue_amttool_command( cmd, ip_address, power_pass, amttool_boot_mode=amttool_boot_mode, stdin=stdin) self.expectThat( _run_mock, MockCalledOnceWith(command, power_pass, stdin=stdin)) self.expectThat(result, Equals(b'output'))
def test_issue_amttool_command_calls__run(self): amt_power_driver = AMTPowerDriver() ip_address = factory.make_ipv4_address() power_pass = factory.make_name("power_pass") amttool_boot_mode = factory.make_name("amttool_boot_mode") stdin = factory.make_name("stdin").encode("utf-8") cmd = choice(["power-cycle", "powerup"]) command = "amttool", ip_address, cmd, amttool_boot_mode _run_mock = self.patch(amt_power_driver, "_run") _run_mock.return_value = b"output" result = amt_power_driver._issue_amttool_command( cmd, ip_address, power_pass, amttool_boot_mode=amttool_boot_mode, stdin=stdin, ) self.expectThat(_run_mock, MockCalledOnceWith(command, power_pass, stdin=stdin)) self.expectThat(result, Equals(b"output"))