def test_amttool_power_on_powers_on(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") _issue_amttool_command_mock = self.patch( amt_power_driver, "_issue_amttool_command" ) amttool_query_state_mock = self.patch( amt_power_driver, "amttool_query_state" ) amttool_query_state_mock.return_value = "on" amt_power_driver.amttool_power_on( ip_address, power_pass, amttool_boot_mode ) self.expectThat( _issue_amttool_command_mock, MockCalledOnceWith( "powerup", ip_address, power_pass, amttool_boot_mode=amttool_boot_mode, stdin=b"yes", ), ) self.expectThat( amttool_query_state_mock, MockCalledOnceWith(ip_address, power_pass), )
def test_amttool_power_on_powers_on(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') _issue_amttool_command_mock = self.patch( amt_power_driver, '_issue_amttool_command') amttool_query_state_mock = self.patch( amt_power_driver, 'amttool_query_state') amttool_query_state_mock.return_value = 'on' amt_power_driver.amttool_power_on( ip_address, power_pass, amttool_boot_mode) self.expectThat( _issue_amttool_command_mock, MockCalledOnceWith( 'powerup', ip_address, power_pass, amttool_boot_mode=amttool_boot_mode, stdin=b'yes')) self.expectThat( amttool_query_state_mock, MockCalledOnceWith( ip_address, power_pass))