Fix failing driver test cases

Removed the mock for get_admin_context because it was causing
the call to Flavor.get_by_id to fail, since the read_deleted
value was mocked and not valid.

Change-Id: Icfdbd308257317798d0646d9bdfbcf3cfd69a913
This commit is contained in:
Kyle L. Henderson 2015-02-02 14:43:57 -06:00
parent 238b415f4f
commit dadc0b8b73
1 changed files with 3 additions and 6 deletions

View File

@ -112,11 +112,10 @@ class TestPowerVMDriver(test.TestCase):
@mock.patch('nova_powervm.virt.powervm.vm.crt_lpar')
@mock.patch('nova_powervm.virt.powervm.vm.UUIDCache')
@mock.patch('nova.virt.configdrive.required_by')
@mock.patch('nova.context.get_admin_context')
@mock.patch('nova.objects.flavor.Flavor.get_by_id')
@mock.patch('nova_powervm.virt.powervm.localdisk.LocalStorage')
@mock.patch('pypowervm.jobs.power.power_on')
def test_spawn_ops(self, mock_pwron, mock_disk, mock_get_flv, mock_get_ctx,
def test_spawn_ops(self, mock_pwron, mock_disk, mock_get_flv,
mock_cfg_drv, mock_uuidcache, mock_crt, mock_find,
mock_apt, mock_sess):
@ -153,12 +152,11 @@ class TestPowerVMDriver(test.TestCase):
@mock.patch('nova_powervm.virt.powervm.vios.add_vscsi_mapping')
@mock.patch('nova_powervm.virt.powervm.vm.UUIDCache')
@mock.patch('nova.virt.configdrive.required_by')
@mock.patch('nova.context.get_admin_context')
@mock.patch('nova.objects.flavor.Flavor.get_by_id')
@mock.patch('nova_powervm.virt.powervm.localdisk.LocalStorage')
@mock.patch('pypowervm.jobs.power.power_on')
def test_spawn_with_cfg(self, mock_pwron, mock_disk, mock_get_flv,
mock_get_ctx, mock_cfg_drv, mock_val_vopt,
mock_cfg_drv, mock_val_vopt,
mock_vios_vscsi, mock_uuidcache, mock_cfg_vopt,
mock_crt, mock_find, mock_apt, mock_sess):
@ -193,13 +191,12 @@ class TestPowerVMDriver(test.TestCase):
@mock.patch('nova_powervm.virt.powervm.vm.dlt_lpar')
@mock.patch('nova_powervm.virt.powervm.vm.UUIDCache')
@mock.patch('nova.virt.configdrive.required_by')
@mock.patch('nova.context.get_admin_context')
@mock.patch('nova.objects.flavor.Flavor.get_by_id')
@mock.patch('nova_powervm.virt.powervm.localdisk.LocalStorage')
@mock.patch('pypowervm.jobs.power.power_on')
@mock.patch('pypowervm.jobs.power.power_off')
def test_spawn_ops_rollback(self, mock_pwroff, mock_pwron, mock_disk,
mock_get_flv, mock_get_ctx, mock_cfg_drv,
mock_get_flv, mock_cfg_drv,
mock_uuidcache, mock_dlt, mock_crt, mock_find,
mock_apt, mock_sess):
"""Validates the PowerVM driver operations. Will do a rollback."""