Ejemplo n.º 1
0
    def test_power_query_returns_unknown_if_not_restapi2(self):
        ip, username, password, server_id, context = self.make_context()
        context["power_control"] = factory.make_name("power_control")
        seamicro_power_driver = SeaMicroPowerDriver()
        power_state = seamicro_power_driver.power_query(
            context["system_id"], context)

        self.assertThat(power_state, Equals("unknown"))
Ejemplo n.º 2
0
    def test_power_query_calls_power_query_seamicro15k_v2(self):
        ip, username, password, server_id, context = self.make_context()
        context['power_control'] = 'restapi2'
        seamicro_power_driver = SeaMicroPowerDriver()
        power_query_seamicro15k_v2_mock = self.patch(
            seamicro_module, 'power_query_seamicro15k_v2')
        power_query_seamicro15k_v2_mock.return_value = 'on'
        power_state = seamicro_power_driver.power_query(
            context['system_id'], context)

        self.expectThat(
            power_query_seamicro15k_v2_mock, MockCalledOnceWith(
                ip, username, password, server_id))
        self.expectThat(power_state, Equals('on'))
Ejemplo n.º 3
0
    def test_power_query_calls_power_query_seamicro15k_v2(self):
        ip, username, password, server_id, context = self.make_context()
        context["power_control"] = "restapi2"
        seamicro_power_driver = SeaMicroPowerDriver()
        power_query_seamicro15k_v2_mock = self.patch(
            seamicro_module, "power_query_seamicro15k_v2")
        power_query_seamicro15k_v2_mock.return_value = "on"
        power_state = seamicro_power_driver.power_query(
            context["system_id"], context)

        self.expectThat(
            power_query_seamicro15k_v2_mock,
            MockCalledOnceWith(ip, username, password, server_id),
        )
        self.expectThat(power_state, Equals("on"))