Пример #1
0
    def test_amttool_query_state_queries_unknown(self):
        amt_power_driver = AMTPowerDriver()
        ip_address = factory.make_ipv4_address()
        power_pass = factory.make_name('power_pass')
        amt_power_driver.ip_address = factory.make_name('ip_address')
        _issue_amttool_command_mock = self.patch(amt_power_driver,
                                                 '_issue_amttool_command')
        _issue_amttool_command_mock.return_value = (AMTTOOL_OUTPUT %
                                                    (b'', b'error'))

        self.assertRaises(PowerActionError,
                          amt_power_driver.amttool_query_state, ip_address,
                          power_pass)
        self.assertThat(_issue_amttool_command_mock,
                        MockCalledOnceWith('info', ip_address, power_pass))
Пример #2
0
    def test_amttool_query_state_queries_unknown(self):
        amt_power_driver = AMTPowerDriver()
        ip_address = factory.make_ipv4_address()
        power_pass = factory.make_name("power_pass")
        amt_power_driver.ip_address = factory.make_name("ip_address")
        _issue_amttool_command_mock = self.patch(amt_power_driver,
                                                 "_issue_amttool_command")
        _issue_amttool_command_mock.return_value = AMTTOOL_OUTPUT % (
            b"",
            b"error",
        )

        self.assertRaises(
            PowerActionError,
            amt_power_driver.amttool_query_state,
            ip_address,
            power_pass,
        )
        self.assertThat(
            _issue_amttool_command_mock,
            MockCalledOnceWith("info", ip_address, power_pass),
        )