Replace 'MagicMock' with 'Mock'
Change-Id: I7aeceede6bd3cb88cf04f398454f9758dbee20f1 Closes-Bug: #1475722
This commit is contained in:
parent
6f326acd26
commit
bc222e97b1
@ -128,7 +128,7 @@ class FakeAggregate(object):
|
|||||||
"""
|
"""
|
||||||
if aggregates is None:
|
if aggregates is None:
|
||||||
aggregates = FakeAggregate.create_aggregates(count)
|
aggregates = FakeAggregate.create_aggregates(count)
|
||||||
return mock.MagicMock(side_effect=aggregates)
|
return mock.Mock(side_effect=aggregates)
|
||||||
|
|
||||||
|
|
||||||
class FakeComputev2Client(object):
|
class FakeComputev2Client(object):
|
||||||
@ -519,7 +519,7 @@ class FakeSecurityGroup(object):
|
|||||||
"""
|
"""
|
||||||
if security_groups is None:
|
if security_groups is None:
|
||||||
security_groups = FakeSecurityGroup.create_security_groups(count)
|
security_groups = FakeSecurityGroup.create_security_groups(count)
|
||||||
return mock.MagicMock(side_effect=security_groups)
|
return mock.Mock(side_effect=security_groups)
|
||||||
|
|
||||||
|
|
||||||
class FakeSecurityGroupRule(object):
|
class FakeSecurityGroupRule(object):
|
||||||
@ -649,7 +649,7 @@ class FakeServer(object):
|
|||||||
"""
|
"""
|
||||||
if servers is None:
|
if servers is None:
|
||||||
servers = FakeServer.create_servers(count)
|
servers = FakeServer.create_servers(count)
|
||||||
return mock.MagicMock(side_effect=servers)
|
return mock.Mock(side_effect=servers)
|
||||||
|
|
||||||
|
|
||||||
class FakeService(object):
|
class FakeService(object):
|
||||||
@ -788,7 +788,7 @@ class FakeFlavor(object):
|
|||||||
"""
|
"""
|
||||||
if flavors is None:
|
if flavors is None:
|
||||||
flavors = FakeFlavor.create_flavors(count)
|
flavors = FakeFlavor.create_flavors(count)
|
||||||
return mock.MagicMock(side_effect=flavors)
|
return mock.Mock(side_effect=flavors)
|
||||||
|
|
||||||
|
|
||||||
class FakeFlavorAccess(object):
|
class FakeFlavorAccess(object):
|
||||||
@ -887,7 +887,7 @@ class FakeKeypair(object):
|
|||||||
"""
|
"""
|
||||||
if keypairs is None:
|
if keypairs is None:
|
||||||
keypairs = FakeKeypair.create_keypairs(count)
|
keypairs = FakeKeypair.create_keypairs(count)
|
||||||
return mock.MagicMock(side_effect=keypairs)
|
return mock.Mock(side_effect=keypairs)
|
||||||
|
|
||||||
|
|
||||||
class FakeAvailabilityZone(object):
|
class FakeAvailabilityZone(object):
|
||||||
@ -1011,7 +1011,7 @@ class FakeFloatingIP(object):
|
|||||||
"""
|
"""
|
||||||
if floating_ips is None:
|
if floating_ips is None:
|
||||||
floating_ips = FakeFloatingIP.create_floating_ips(count)
|
floating_ips = FakeFloatingIP.create_floating_ips(count)
|
||||||
return mock.MagicMock(side_effect=floating_ips)
|
return mock.Mock(side_effect=floating_ips)
|
||||||
|
|
||||||
|
|
||||||
class FakeFloatingIPPool(object):
|
class FakeFloatingIPPool(object):
|
||||||
|
@ -292,7 +292,7 @@ class TestFlavorDelete(TestFlavor):
|
|||||||
|
|
||||||
find_mock_result = [self.flavors[0], exceptions.CommandError]
|
find_mock_result = [self.flavors[0], exceptions.CommandError]
|
||||||
self.flavors_mock.get = (
|
self.flavors_mock.get = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
self.flavors_mock.find.side_effect = exceptions.NotFound(None)
|
self.flavors_mock.find.side_effect = exceptions.NotFound(None)
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ class TestServerCreate(TestServer):
|
|||||||
|
|
||||||
@mock.patch('openstackclient.compute.v2.server.io.open')
|
@mock.patch('openstackclient.compute.v2.server.io.open')
|
||||||
def test_server_create_userdata(self, mock_open):
|
def test_server_create_userdata(self, mock_open):
|
||||||
mock_file = mock.MagicMock(name='File')
|
mock_file = mock.Mock(name='File')
|
||||||
mock_open.return_value = mock_file
|
mock_open.return_value = mock_file
|
||||||
mock_open.read.return_value = '#!/bin/sh'
|
mock_open.read.return_value = '#!/bin/sh'
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class TestServerBackupCreate(TestServerBackup):
|
|||||||
count=count,
|
count=count,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.images_mock.get = mock.MagicMock(side_effect=images)
|
self.images_mock.get = mock.Mock(side_effect=images)
|
||||||
return images
|
return images
|
||||||
|
|
||||||
def test_server_backup_defaults(self):
|
def test_server_backup_defaults(self):
|
||||||
@ -181,7 +181,7 @@ class TestServerBackupCreate(TestServerBackup):
|
|||||||
count=5,
|
count=5,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.images_mock.get = mock.MagicMock(
|
self.images_mock.get = mock.Mock(
|
||||||
side_effect=images,
|
side_effect=images,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ class TestServerBackupCreate(TestServerBackup):
|
|||||||
count=5,
|
count=5,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.images_mock.get = mock.MagicMock(
|
self.images_mock.get = mock.Mock(
|
||||||
side_effect=images,
|
side_effect=images,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ class TestServerImageCreate(TestServerImage):
|
|||||||
count=count,
|
count=count,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.images_mock.get = mock.MagicMock(side_effect=images)
|
self.images_mock.get = mock.Mock(side_effect=images)
|
||||||
self.servers_mock.create_image = mock.MagicMock(
|
self.servers_mock.create_image = mock.Mock(
|
||||||
return_value=images[0].id,
|
return_value=images[0].id,
|
||||||
)
|
)
|
||||||
return images
|
return images
|
||||||
|
@ -89,7 +89,7 @@ class TestServiceDelete(TestService):
|
|||||||
|
|
||||||
delete_mock_result = [None, exceptions.CommandError]
|
delete_mock_result = [None, exceptions.CommandError]
|
||||||
self.service_mock.delete = (
|
self.service_mock.delete = (
|
||||||
mock.MagicMock(side_effect=delete_mock_result)
|
mock.Mock(side_effect=delete_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -200,7 +200,7 @@ class FakeResource(object):
|
|||||||
returned, which looks like a function call.
|
returned, which looks like a function call.
|
||||||
"""
|
"""
|
||||||
for (name, ret) in six.iteritems(methods):
|
for (name, ret) in six.iteritems(methods):
|
||||||
method = mock.MagicMock(return_value=ret)
|
method = mock.Mock(return_value=ret)
|
||||||
setattr(self, name, method)
|
setattr(self, name, method)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -25,12 +25,12 @@ class TestCatalog(utils.TestCommand):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCatalog, self).setUp()
|
super(TestCatalog, self).setUp()
|
||||||
|
|
||||||
self.sc_mock = mock.MagicMock()
|
self.sc_mock = mock.Mock()
|
||||||
self.sc_mock.service_catalog.catalog.return_value = [
|
self.sc_mock.service_catalog.catalog.return_value = [
|
||||||
self.service_catalog,
|
self.service_catalog,
|
||||||
]
|
]
|
||||||
|
|
||||||
self.auth_mock = mock.MagicMock()
|
self.auth_mock = mock.Mock()
|
||||||
self.app.client_manager.session = self.auth_mock
|
self.app.client_manager.session = self.auth_mock
|
||||||
|
|
||||||
self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock
|
self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock
|
||||||
|
@ -170,7 +170,7 @@ class TestRoleAssignmentList(TestRoleAssignment):
|
|||||||
|
|
||||||
def test_role_assignment_list_def_creds(self):
|
def test_role_assignment_list_def_creds(self):
|
||||||
|
|
||||||
auth_ref = self.app.client_manager.auth_ref = mock.MagicMock()
|
auth_ref = self.app.client_manager.auth_ref = mock.Mock()
|
||||||
auth_ref.project_id.return_value = identity_fakes.project_id
|
auth_ref.project_id.return_value = identity_fakes.project_id
|
||||||
auth_ref.user_id.return_value = identity_fakes.user_id
|
auth_ref.user_id.return_value = identity_fakes.user_id
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ class FakeCredential(object):
|
|||||||
if credentials is None:
|
if credentials is None:
|
||||||
credentials = FakeCredential.create_credentials(count)
|
credentials = FakeCredential.create_credentials(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=credentials)
|
return mock.Mock(side_effect=credentials)
|
||||||
|
|
||||||
|
|
||||||
class FakeUser(object):
|
class FakeUser(object):
|
||||||
@ -819,7 +819,7 @@ class FakeGroup(object):
|
|||||||
if groups is None:
|
if groups is None:
|
||||||
groups = FakeGroup.create_groups(count)
|
groups = FakeGroup.create_groups(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=groups)
|
return mock.Mock(side_effect=groups)
|
||||||
|
|
||||||
|
|
||||||
class FakeEndpoint(object):
|
class FakeEndpoint(object):
|
||||||
|
@ -50,12 +50,12 @@ class TestCatalog(utils.TestCommand):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCatalog, self).setUp()
|
super(TestCatalog, self).setUp()
|
||||||
|
|
||||||
self.sc_mock = mock.MagicMock()
|
self.sc_mock = mock.Mock()
|
||||||
self.sc_mock.service_catalog.catalog.return_value = [
|
self.sc_mock.service_catalog.catalog.return_value = [
|
||||||
self.fake_service,
|
self.fake_service,
|
||||||
]
|
]
|
||||||
|
|
||||||
self.auth_mock = mock.MagicMock()
|
self.auth_mock = mock.Mock()
|
||||||
self.app.client_manager.session = self.auth_mock
|
self.app.client_manager.session = self.auth_mock
|
||||||
|
|
||||||
self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock
|
self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock
|
||||||
|
@ -196,7 +196,7 @@ class TestCredentialDelete(TestCredential):
|
|||||||
|
|
||||||
delete_mock_result = [None, exceptions.CommandError]
|
delete_mock_result = [None, exceptions.CommandError]
|
||||||
self.credentials_mock.delete = (
|
self.credentials_mock.delete = (
|
||||||
mock.MagicMock(side_effect=delete_mock_result)
|
mock.Mock(side_effect=delete_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -239,7 +239,7 @@ class TestGroupDelete(TestGroup):
|
|||||||
def test_group_delete_with_domain(self):
|
def test_group_delete_with_domain(self):
|
||||||
get_mock_result = [exceptions.CommandError, self.groups[0]]
|
get_mock_result = [exceptions.CommandError, self.groups[0]]
|
||||||
self.groups_mock.get = (
|
self.groups_mock.get = (
|
||||||
mock.MagicMock(side_effect=get_mock_result))
|
mock.Mock(side_effect=get_mock_result))
|
||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
'--domain', self.domain.id,
|
'--domain', self.domain.id,
|
||||||
@ -487,7 +487,7 @@ class TestGroupSet(TestGroup):
|
|||||||
def test_group_set_with_domain(self):
|
def test_group_set_with_domain(self):
|
||||||
get_mock_result = [exceptions.CommandError, self.group]
|
get_mock_result = [exceptions.CommandError, self.group]
|
||||||
self.groups_mock.get = (
|
self.groups_mock.get = (
|
||||||
mock.MagicMock(side_effect=get_mock_result))
|
mock.Mock(side_effect=get_mock_result))
|
||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
'--domain', self.domain.id,
|
'--domain', self.domain.id,
|
||||||
@ -550,7 +550,7 @@ class TestGroupShow(TestGroup):
|
|||||||
def test_group_show_with_domain(self):
|
def test_group_show_with_domain(self):
|
||||||
get_mock_result = [exceptions.CommandError, self.group]
|
get_mock_result = [exceptions.CommandError, self.group]
|
||||||
self.groups_mock.get = (
|
self.groups_mock.get = (
|
||||||
mock.MagicMock(side_effect=get_mock_result))
|
mock.Mock(side_effect=get_mock_result))
|
||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
'--domain', self.domain.id,
|
'--domain', self.domain.id,
|
||||||
|
@ -377,7 +377,7 @@ class TestRoleAssignmentList(TestRoleAssignment):
|
|||||||
|
|
||||||
def test_role_assignment_list_def_creds(self):
|
def test_role_assignment_list_def_creds(self):
|
||||||
|
|
||||||
auth_ref = self.app.client_manager.auth_ref = mock.MagicMock()
|
auth_ref = self.app.client_manager.auth_ref = mock.Mock()
|
||||||
auth_ref.project_id.return_value = identity_fakes.project_id
|
auth_ref.project_id.return_value = identity_fakes.project_id
|
||||||
auth_ref.user_id.return_value = identity_fakes.user_id
|
auth_ref.user_id.return_value = identity_fakes.user_id
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class TestImageCreate(TestImage):
|
|||||||
|
|
||||||
@mock.patch('openstackclient.image.v1.image.io.open', name='Open')
|
@mock.patch('openstackclient.image.v1.image.io.open', name='Open')
|
||||||
def test_image_create_file(self, mock_open):
|
def test_image_create_file(self, mock_open):
|
||||||
mock_file = mock.MagicMock(name='File')
|
mock_file = mock.Mock(name='File')
|
||||||
mock_open.return_value = mock_file
|
mock_open.return_value = mock_file
|
||||||
mock_open.read.return_value = image_fakes.image_data
|
mock_open.read.return_value = image_fakes.image_data
|
||||||
mock_exception = {
|
mock_exception = {
|
||||||
|
@ -245,7 +245,7 @@ class FakeImage(object):
|
|||||||
if images is None:
|
if images is None:
|
||||||
images = FakeImage.create_images(count)
|
images = FakeImage.create_images(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=images)
|
return mock.Mock(side_effect=images)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_image_columns(image=None):
|
def get_image_columns(image=None):
|
||||||
|
@ -136,7 +136,7 @@ class FakeAddressScope(object):
|
|||||||
"""
|
"""
|
||||||
if address_scopes is None:
|
if address_scopes is None:
|
||||||
address_scopes = FakeAddressScope.create_address_scopes(count)
|
address_scopes = FakeAddressScope.create_address_scopes(count)
|
||||||
return mock.MagicMock(side_effect=address_scopes)
|
return mock.Mock(side_effect=address_scopes)
|
||||||
|
|
||||||
|
|
||||||
class FakeAvailabilityZone(object):
|
class FakeAvailabilityZone(object):
|
||||||
@ -344,7 +344,7 @@ class FakeNetwork(object):
|
|||||||
"""
|
"""
|
||||||
if networks is None:
|
if networks is None:
|
||||||
networks = FakeNetwork.create_networks(count)
|
networks = FakeNetwork.create_networks(count)
|
||||||
return mock.MagicMock(side_effect=networks)
|
return mock.Mock(side_effect=networks)
|
||||||
|
|
||||||
|
|
||||||
class FakeNetworkSegment(object):
|
class FakeNetworkSegment(object):
|
||||||
@ -488,7 +488,7 @@ class FakePort(object):
|
|||||||
"""
|
"""
|
||||||
if ports is None:
|
if ports is None:
|
||||||
ports = FakePort.create_ports(count)
|
ports = FakePort.create_ports(count)
|
||||||
return mock.MagicMock(side_effect=ports)
|
return mock.Mock(side_effect=ports)
|
||||||
|
|
||||||
|
|
||||||
class FakeNetworkAgent(object):
|
class FakeNetworkAgent(object):
|
||||||
@ -555,7 +555,7 @@ class FakeNetworkAgent(object):
|
|||||||
"""
|
"""
|
||||||
if agents is None:
|
if agents is None:
|
||||||
agents = FakeNetworkAgent.create_network_agents(count)
|
agents = FakeNetworkAgent.create_network_agents(count)
|
||||||
return mock.MagicMock(side_effect=agents)
|
return mock.Mock(side_effect=agents)
|
||||||
|
|
||||||
|
|
||||||
class FakeNetworkRBAC(object):
|
class FakeNetworkRBAC(object):
|
||||||
@ -625,7 +625,7 @@ class FakeNetworkRBAC(object):
|
|||||||
"""
|
"""
|
||||||
if rbac_policies is None:
|
if rbac_policies is None:
|
||||||
rbac_policies = FakeNetworkRBAC.create_network_rbacs(count)
|
rbac_policies = FakeNetworkRBAC.create_network_rbacs(count)
|
||||||
return mock.MagicMock(side_effect=rbac_policies)
|
return mock.Mock(side_effect=rbac_policies)
|
||||||
|
|
||||||
|
|
||||||
class FakeRouter(object):
|
class FakeRouter(object):
|
||||||
@ -703,7 +703,7 @@ class FakeRouter(object):
|
|||||||
"""
|
"""
|
||||||
if routers is None:
|
if routers is None:
|
||||||
routers = FakeRouter.create_routers(count)
|
routers = FakeRouter.create_routers(count)
|
||||||
return mock.MagicMock(side_effect=routers)
|
return mock.Mock(side_effect=routers)
|
||||||
|
|
||||||
|
|
||||||
class FakeSecurityGroup(object):
|
class FakeSecurityGroup(object):
|
||||||
@ -776,7 +776,7 @@ class FakeSecurityGroup(object):
|
|||||||
"""
|
"""
|
||||||
if security_groups is None:
|
if security_groups is None:
|
||||||
security_groups = FakeSecurityGroup.create_security_groups(count)
|
security_groups = FakeSecurityGroup.create_security_groups(count)
|
||||||
return mock.MagicMock(side_effect=security_groups)
|
return mock.Mock(side_effect=security_groups)
|
||||||
|
|
||||||
|
|
||||||
class FakeSecurityGroupRule(object):
|
class FakeSecurityGroupRule(object):
|
||||||
@ -855,7 +855,7 @@ class FakeSecurityGroupRule(object):
|
|||||||
if security_group_rules is None:
|
if security_group_rules is None:
|
||||||
security_group_rules = (
|
security_group_rules = (
|
||||||
FakeSecurityGroupRule.create_security_group_rules(count))
|
FakeSecurityGroupRule.create_security_group_rules(count))
|
||||||
return mock.MagicMock(side_effect=security_group_rules)
|
return mock.Mock(side_effect=security_group_rules)
|
||||||
|
|
||||||
|
|
||||||
class FakeSubnet(object):
|
class FakeSubnet(object):
|
||||||
@ -938,7 +938,7 @@ class FakeSubnet(object):
|
|||||||
"""
|
"""
|
||||||
if subnets is None:
|
if subnets is None:
|
||||||
subnets = FakeSubnet.create_subnets(count)
|
subnets = FakeSubnet.create_subnets(count)
|
||||||
return mock.MagicMock(side_effect=subnets)
|
return mock.Mock(side_effect=subnets)
|
||||||
|
|
||||||
|
|
||||||
class FakeFloatingIP(object):
|
class FakeFloatingIP(object):
|
||||||
@ -1015,7 +1015,7 @@ class FakeFloatingIP(object):
|
|||||||
"""
|
"""
|
||||||
if floating_ips is None:
|
if floating_ips is None:
|
||||||
floating_ips = FakeFloatingIP.create_floating_ips(count)
|
floating_ips = FakeFloatingIP.create_floating_ips(count)
|
||||||
return mock.MagicMock(side_effect=floating_ips)
|
return mock.Mock(side_effect=floating_ips)
|
||||||
|
|
||||||
|
|
||||||
class FakeSubnetPool(object):
|
class FakeSubnetPool(object):
|
||||||
@ -1097,4 +1097,4 @@ class FakeSubnetPool(object):
|
|||||||
"""
|
"""
|
||||||
if subnet_pools is None:
|
if subnet_pools is None:
|
||||||
subnet_pools = FakeSubnetPool.create_subnet_pools(count)
|
subnet_pools = FakeSubnetPool.create_subnet_pools(count)
|
||||||
return mock.MagicMock(side_effect=subnet_pools)
|
return mock.Mock(side_effect=subnet_pools)
|
||||||
|
@ -216,7 +216,7 @@ class TestDeleteAddressScope(TestAddressScope):
|
|||||||
|
|
||||||
find_mock_result = [self._address_scopes[0], exceptions.CommandError]
|
find_mock_result = [self._address_scopes[0], exceptions.CommandError]
|
||||||
self.network.find_address_scope = (
|
self.network.find_address_scope = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -204,7 +204,7 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
|
|
||||||
find_mock_result = [self.floating_ips[0], exceptions.CommandError]
|
find_mock_result = [self.floating_ips[0], exceptions.CommandError]
|
||||||
self.network.find_ip = (
|
self.network.find_ip = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -454,7 +454,7 @@ class TestDeleteFloatingIPCompute(TestFloatingIPCompute):
|
|||||||
|
|
||||||
find_mock_result = [self.floating_ips[0], exceptions.CommandError]
|
find_mock_result = [self.floating_ips[0], exceptions.CommandError]
|
||||||
self.compute.floating_ips.get = (
|
self.compute.floating_ips.get = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
self.compute.floating_ips.find.side_effect = exceptions.NotFound(None)
|
self.compute.floating_ips.find.side_effect = exceptions.NotFound(None)
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class TestDeleteNetworkAgent(TestNetworkAgent):
|
|||||||
|
|
||||||
find_mock_result = [self.network_agents[0], exceptions.CommandError]
|
find_mock_result = [self.network_agents[0], exceptions.CommandError]
|
||||||
self.network.get_agent = (
|
self.network.get_agent = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -259,7 +259,7 @@ class TestDeleteNetworkRBAC(TestNetworkRBAC):
|
|||||||
|
|
||||||
find_mock_result = [self.rbac_policies[0], exceptions.CommandError]
|
find_mock_result = [self.rbac_policies[0], exceptions.CommandError]
|
||||||
self.network.find_rbac_policy = (
|
self.network.find_rbac_policy = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -289,7 +289,7 @@ class TestDeletePort(TestPort):
|
|||||||
|
|
||||||
find_mock_result = [self._ports[0], exceptions.CommandError]
|
find_mock_result = [self._ports[0], exceptions.CommandError]
|
||||||
self.network.find_port = (
|
self.network.find_port = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -263,7 +263,7 @@ class TestDeleteRouter(TestRouter):
|
|||||||
|
|
||||||
find_mock_result = [self._routers[0], exceptions.CommandError]
|
find_mock_result = [self._routers[0], exceptions.CommandError]
|
||||||
self.network.find_router = (
|
self.network.find_router = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -279,7 +279,7 @@ class TestDeleteSecurityGroupNetwork(TestSecurityGroupNetwork):
|
|||||||
|
|
||||||
find_mock_result = [self._security_groups[0], exceptions.CommandError]
|
find_mock_result = [self._security_groups[0], exceptions.CommandError]
|
||||||
self.network.find_security_group = (
|
self.network.find_security_group = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -365,7 +365,7 @@ class TestDeleteSecurityGroupCompute(TestSecurityGroupCompute):
|
|||||||
|
|
||||||
find_mock_result = [self._security_groups[0], exceptions.CommandError]
|
find_mock_result = [self._security_groups[0], exceptions.CommandError]
|
||||||
self.compute.security_groups.get = (
|
self.compute.security_groups.get = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
self.compute.security_groups.find.side_effect = (
|
self.compute.security_groups.find.side_effect = (
|
||||||
exceptions.NotFound(None))
|
exceptions.NotFound(None))
|
||||||
|
@ -723,7 +723,7 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|||||||
find_mock_result = [
|
find_mock_result = [
|
||||||
self._security_group_rules[0], exceptions.CommandError]
|
self._security_group_rules[0], exceptions.CommandError]
|
||||||
self.network.find_security_group_rule = (
|
self.network.find_security_group_rule = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -803,7 +803,7 @@ class TestDeleteSecurityGroupRuleCompute(TestSecurityGroupRuleCompute):
|
|||||||
|
|
||||||
find_mock_result = [None, exceptions.CommandError]
|
find_mock_result = [None, exceptions.CommandError]
|
||||||
self.compute.security_group_rules.delete = (
|
self.compute.security_group_rules.delete = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -489,7 +489,7 @@ class TestDeleteSubnet(TestSubnet):
|
|||||||
|
|
||||||
find_mock_result = [self._subnets[0], exceptions.CommandError]
|
find_mock_result = [self._subnets[0], exceptions.CommandError]
|
||||||
self.network.find_subnet = (
|
self.network.find_subnet = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -310,7 +310,7 @@ class TestDeleteSubnetPool(TestSubnetPool):
|
|||||||
|
|
||||||
find_mock_result = [self._subnet_pools[0], exceptions.CommandError]
|
find_mock_result = [self._subnet_pools[0], exceptions.CommandError]
|
||||||
self.network.find_subnet_pool = (
|
self.network.find_subnet_pool = (
|
||||||
mock.MagicMock(side_effect=find_mock_result)
|
mock.Mock(side_effect=find_mock_result)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -201,7 +201,7 @@ class FakeTransfer(object):
|
|||||||
if transfers is None:
|
if transfers is None:
|
||||||
transfers = FakeTransfer.create_transfers(count)
|
transfers = FakeTransfer.create_transfers(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=transfers)
|
return mock.Mock(side_effect=transfers)
|
||||||
|
|
||||||
|
|
||||||
class FakeService(object):
|
class FakeService(object):
|
||||||
@ -274,7 +274,7 @@ class FakeService(object):
|
|||||||
if services is None:
|
if services is None:
|
||||||
services = FakeService.create_services(count)
|
services = FakeService.create_services(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=services)
|
return mock.Mock(side_effect=services)
|
||||||
|
|
||||||
|
|
||||||
class FakeQos(object):
|
class FakeQos(object):
|
||||||
@ -343,7 +343,7 @@ class FakeQos(object):
|
|||||||
if qoses is None:
|
if qoses is None:
|
||||||
qoses = FakeQos.create_qoses(count)
|
qoses = FakeQos.create_qoses(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=qoses)
|
return mock.Mock(side_effect=qoses)
|
||||||
|
|
||||||
|
|
||||||
class FakeVolume(object):
|
class FakeVolume(object):
|
||||||
@ -427,7 +427,7 @@ class FakeVolume(object):
|
|||||||
if volumes is None:
|
if volumes is None:
|
||||||
volumes = FakeVolume.create_volumes(count)
|
volumes = FakeVolume.create_volumes(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=volumes)
|
return mock.Mock(side_effect=volumes)
|
||||||
|
|
||||||
|
|
||||||
class FakeImagev1Client(object):
|
class FakeImagev1Client(object):
|
||||||
@ -547,4 +547,4 @@ class FakeType(object):
|
|||||||
if types is None:
|
if types is None:
|
||||||
types = FakeType.create_types(count)
|
types = FakeType.create_types(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=types)
|
return mock.Mock(side_effect=types)
|
||||||
|
@ -107,7 +107,7 @@ class FakeTransfer(object):
|
|||||||
if transfers is None:
|
if transfers is None:
|
||||||
transfers = FakeTransfer.create_transfers(count)
|
transfers = FakeTransfer.create_transfers(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=transfers)
|
return mock.Mock(side_effect=transfers)
|
||||||
|
|
||||||
|
|
||||||
class FakeTypeAccess(object):
|
class FakeTypeAccess(object):
|
||||||
@ -331,7 +331,7 @@ class FakeVolume(object):
|
|||||||
if volumes is None:
|
if volumes is None:
|
||||||
volumes = FakeVolume.create_volumes(count)
|
volumes = FakeVolume.create_volumes(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=volumes)
|
return mock.Mock(side_effect=volumes)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_volume_columns(volume=None):
|
def get_volume_columns(volume=None):
|
||||||
@ -492,7 +492,7 @@ class FakeBackup(object):
|
|||||||
if backups is None:
|
if backups is None:
|
||||||
backups = FakeBackup.create_backups(count)
|
backups = FakeBackup.create_backups(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=backups)
|
return mock.Mock(side_effect=backups)
|
||||||
|
|
||||||
|
|
||||||
class FakeExtension(object):
|
class FakeExtension(object):
|
||||||
@ -623,7 +623,7 @@ class FakeQos(object):
|
|||||||
if qoses is None:
|
if qoses is None:
|
||||||
qoses = FakeQos.create_qoses(count)
|
qoses = FakeQos.create_qoses(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=qoses)
|
return mock.Mock(side_effect=qoses)
|
||||||
|
|
||||||
|
|
||||||
class FakeSnapshot(object):
|
class FakeSnapshot(object):
|
||||||
@ -696,7 +696,7 @@ class FakeSnapshot(object):
|
|||||||
if snapshots is None:
|
if snapshots is None:
|
||||||
snapshots = FakeSnapshot.create_snapshots(count)
|
snapshots = FakeSnapshot.create_snapshots(count)
|
||||||
|
|
||||||
return mock.MagicMock(side_effect=snapshots)
|
return mock.Mock(side_effect=snapshots)
|
||||||
|
|
||||||
|
|
||||||
class FakeType(object):
|
class FakeType(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user