Merge "Fix mock specs set to strings"
This commit is contained in:
commit
2e5d0eda84
|
@ -26,6 +26,8 @@ import random
|
|||
import warnings
|
||||
|
||||
import fixtures
|
||||
import futurist
|
||||
from keystoneauth1 import adapter as ksa_adap
|
||||
import mock
|
||||
from neutronclient.common import exceptions as neutron_client_exc
|
||||
import os_resource_classes as orc
|
||||
|
@ -1116,7 +1118,7 @@ class SynchronousThreadPoolExecutorFixture(fixtures.Fixture):
|
|||
|
||||
def fake_submit(_self, fn, *args, **kwargs):
|
||||
result = fn(*args, **kwargs)
|
||||
future = mock.Mock(spec='futurist.Future')
|
||||
future = mock.Mock(spec=futurist.Future)
|
||||
future.return_value.result.return_value = result
|
||||
return future
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
|
@ -1462,7 +1464,7 @@ class NeutronFixture(fixtures.Fixture):
|
|||
self.test.stub_out(
|
||||
'nova.network.neutronv2.api._get_ksa_client',
|
||||
lambda *args, **kwargs: mock.Mock(
|
||||
spec='keystoneauth1.adapter.Adapter'))
|
||||
spec=ksa_adap.Adapter))
|
||||
self.test.stub_out(
|
||||
'nova.network.neutronv2.api.API._create_port_binding',
|
||||
self.fake_create_port_binding)
|
||||
|
|
|
@ -5387,7 +5387,7 @@ class TestNeutronv2WithMock(TestNeutronv2Base):
|
|||
mock_populate_ext_values):
|
||||
"""Makes sure we rollback ports and VIFs if we fail updating ports"""
|
||||
instance = fake_instance.fake_instance_obj(self.context)
|
||||
ntrn = mock.Mock(spec='neutronclient.v2_0.client.Client')
|
||||
ntrn = mock.Mock(spec=client.Client)
|
||||
# we have two requests, one with a preexisting port and one where nova
|
||||
# created the port (on the same network)
|
||||
requests_and_created_ports = [
|
||||
|
|
|
@ -8009,10 +8009,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
|
||||
new_size_in_kb = 20 * 1024 * 1024
|
||||
|
||||
guest = mock.Mock(spec='nova.virt.libvirt.guest.Guest')
|
||||
guest = mock.Mock(spec=libvirt_guest.Guest)
|
||||
# block_device
|
||||
block_device = mock.Mock(
|
||||
spec='nova.virt.libvirt.guest.BlockDevice')
|
||||
block_device = mock.Mock(spec=libvirt_guest.BlockDevice)
|
||||
block_device.resize = mock.Mock()
|
||||
guest.get_block_device = mock.Mock(return_value=block_device)
|
||||
drvr._host.get_guest = mock.Mock(return_value=guest)
|
||||
|
@ -8083,11 +8082,10 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
}
|
||||
new_size_in_kb = 20 * 1024 * 1024
|
||||
|
||||
guest = mock.Mock(spec='nova.virt.libvirt.guest.Guest')
|
||||
guest = mock.Mock(spec=libvirt_guest.Guest)
|
||||
guest.get_power_state = mock.Mock(return_value=power_state.RUNNING)
|
||||
# block_device
|
||||
block_device = mock.Mock(
|
||||
spec='nova.virt.libvirt.guest.BlockDevice')
|
||||
block_device = mock.Mock(spec=libvirt_guest.BlockDevice)
|
||||
block_device.resize = mock.Mock(
|
||||
side_effect=fakelibvirt.libvirtError('ERR'))
|
||||
guest.get_block_device = mock.Mock(return_value=block_device)
|
||||
|
@ -8111,13 +8109,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
}
|
||||
new_size_in_kb = 20 * 1024 * 1024
|
||||
|
||||
guest = mock.Mock(spec='nova.virt.libvirt.guest.Guest')
|
||||
guest = mock.Mock(spec=libvirt_guest.Guest)
|
||||
# block_device
|
||||
block_device = mock.Mock(
|
||||
spec='nova.virt.libvirt.guest.BlockDevice')
|
||||
block_device = mock.Mock(spec=libvirt_guest.BlockDevice)
|
||||
block_device.resize = mock.Mock()
|
||||
disk = mock.Mock(
|
||||
spec='nova.virt.libvirt.config.LibvirtConfigGuestDisk',
|
||||
spec=vconfig.LibvirtConfigGuestDisk,
|
||||
serial='58a84f6d-3f0c-4e19-a0af-eb657b790657',
|
||||
target_dev='vdb')
|
||||
guest.get_block_device = mock.Mock(return_value=block_device)
|
||||
|
@ -8148,13 +8145,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
}
|
||||
new_size_in_kb = 20 * 1024 * 1024
|
||||
|
||||
guest = mock.Mock(spec='nova.virt.libvirt.guest.Guest')
|
||||
guest = mock.Mock(spec=libvirt_guest.Guest)
|
||||
# block_device
|
||||
block_device = mock.Mock(
|
||||
spec='nova.virt.libvirt.guest.BlockDevice')
|
||||
block_device = mock.Mock(spec=libvirt_guest.BlockDevice)
|
||||
block_device.resize = mock.Mock()
|
||||
disk = mock.Mock(
|
||||
spec='nova.virt.libvirt.config.LibvirtConfigGuestDisk',
|
||||
spec=vconfig.LibvirtConfigGuestDisk,
|
||||
serial='12345678-abcd-abcd-abcd-0123456789012',
|
||||
target_dev='vdb')
|
||||
guest.get_block_device = mock.Mock(return_value=block_device)
|
||||
|
@ -20064,7 +20060,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
|||
# found on the guest after a libvirt error during detach.
|
||||
instance = self._create_instance()
|
||||
vif = _fake_network_info(self, 1)[0]
|
||||
guest = mock.Mock(spec='nova.virt.libvirt.guest.Guest')
|
||||
guest = mock.Mock(spec=libvirt_guest.Guest)
|
||||
guest.get_power_state = mock.Mock()
|
||||
self.drvr._host.get_guest = mock.Mock(return_value=guest)
|
||||
error = fakelibvirt.libvirtError(
|
||||
|
|
Loading…
Reference in New Issue