Exemplo n.º 1
0
    def test_power_off_powers_off_with_wsman(self):
        amt_power_driver = AMTPowerDriver()
        context = make_context()
        _get_amt_command_mock = self.patch(
            amt_power_driver, "_get_amt_command"
        )
        _get_amt_command_mock.return_value = "wsman"
        wsman_query_state_mock = self.patch(
            amt_power_driver, "wsman_query_state"
        )
        wsman_query_state_mock.return_value = "on"
        wsman_power_off_mock = self.patch(amt_power_driver, "wsman_power_off")

        amt_power_driver.power_off(context["system_id"], context)
        self.expectThat(
            _get_amt_command_mock,
            MockCalledOnceWith(context["ip_address"], context["power_pass"]),
        )
        self.expectThat(
            wsman_query_state_mock,
            MockCalledOnceWith(context["ip_address"], context["power_pass"]),
        )
        self.expectThat(
            wsman_power_off_mock,
            MockCalledOnceWith(context["ip_address"], context["power_pass"]),
        )
Exemplo n.º 2
0
    def test_power_off_powers_off_with_wsman(self):
        amt_power_driver = AMTPowerDriver()
        context = make_context()
        _get_amt_command_mock = self.patch(amt_power_driver,
                                           '_get_amt_command')
        _get_amt_command_mock.return_value = 'wsman'
        wsman_query_state_mock = self.patch(amt_power_driver,
                                            'wsman_query_state')
        wsman_query_state_mock.return_value = 'on'
        wsman_power_off_mock = self.patch(amt_power_driver, 'wsman_power_off')

        amt_power_driver.power_off(context['system_id'], context)
        self.expectThat(
            _get_amt_command_mock,
            MockCalledOnceWith(context['ip_address'], context['power_pass']))
        self.expectThat(
            wsman_query_state_mock,
            MockCalledOnceWith(context['ip_address'], context['power_pass']))
        self.expectThat(
            wsman_power_off_mock,
            MockCalledOnceWith(context['ip_address'], context['power_pass']))