Exemplo n.º 1
0
    def test_power_query_calls_power_state_nova(self):
        system_id, machine, tenant, username, password, authurl, context = (
            self.make_parameters())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        power_control_nova_mock.return_value = 'off'
        expected_result = nova_power_driver.power_query(system_id, context)

        self.expectThat(
            power_control_nova_mock, MockCalledOnceWith('query', **context))
        self.expectThat(expected_result, Equals('off'))
Exemplo n.º 2
0
        nova_power_driver.power_on(system_id, context)

        self.assertThat(
            power_control_nova_mock, MockCalledOnceWith('on', **context))

    def test_power_off_calls_power_control_nova_v3(self):
        system_id, machine, tenant, username, password, authurl,
            user_domain_name, project_domain_name, context = (
            self.make_parameters_v3())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        nova_power_driver.power_off(system_id, context)

        self.assertThat(
            power_control_nova_mock, MockCalledOnceWith('off', **context))

    def test_power_query_calls_power_state_nova_v3(self):
        system_id, machine, tenant, username, password, authurl,
            user_domain_name, project_domain_name, context = (
            self.make_parameters_v3())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        power_control_nova_mock.return_value = 'off'
        expected_result = nova_power_driver.power_query(system_id, context)

        self.expectThat(
            power_control_nova_mock, MockCalledOnceWith('query', **context))
        self.expectThat(expected_result, Equals('off'))