From bc222e97b155152be3c8cced987ef1d443076d10 Mon Sep 17 00:00:00 2001 From: qtang Date: Wed, 14 Sep 2016 13:27:31 +0800 Subject: [PATCH] Replace 'MagicMock' with 'Mock' Change-Id: I7aeceede6bd3cb88cf04f398454f9758dbee20f1 Closes-Bug: #1475722 --- .../tests/unit/compute/v2/fakes.py | 12 +++++----- .../tests/unit/compute/v2/test_flavor.py | 2 +- .../tests/unit/compute/v2/test_server.py | 2 +- .../unit/compute/v2/test_server_backup.py | 6 ++--- .../unit/compute/v2/test_server_image.py | 4 ++-- .../tests/unit/compute/v2/test_service.py | 2 +- openstackclient/tests/unit/fakes.py | 2 +- .../tests/unit/identity/v2_0/test_catalog.py | 4 ++-- .../identity/v2_0/test_role_assignment.py | 2 +- .../tests/unit/identity/v3/fakes.py | 4 ++-- .../tests/unit/identity/v3/test_catalog.py | 4 ++-- .../tests/unit/identity/v3/test_credential.py | 2 +- .../tests/unit/identity/v3/test_group.py | 6 ++--- .../unit/identity/v3/test_role_assignment.py | 2 +- .../tests/unit/image/v1/test_image.py | 2 +- openstackclient/tests/unit/image/v2/fakes.py | 2 +- .../tests/unit/network/v2/fakes.py | 22 +++++++++---------- .../unit/network/v2/test_address_scope.py | 2 +- .../tests/unit/network/v2/test_floating_ip.py | 4 ++-- .../unit/network/v2/test_network_agent.py | 2 +- .../unit/network/v2/test_network_rbac.py | 2 +- .../tests/unit/network/v2/test_port.py | 2 +- .../tests/unit/network/v2/test_router.py | 2 +- .../unit/network/v2/test_security_group.py | 4 ++-- .../network/v2/test_security_group_rule.py | 4 ++-- .../tests/unit/network/v2/test_subnet.py | 2 +- .../tests/unit/network/v2/test_subnet_pool.py | 2 +- openstackclient/tests/unit/volume/v1/fakes.py | 10 ++++----- openstackclient/tests/unit/volume/v2/fakes.py | 10 ++++----- 29 files changed, 63 insertions(+), 63 deletions(-) diff --git a/openstackclient/tests/unit/compute/v2/fakes.py b/openstackclient/tests/unit/compute/v2/fakes.py index 0e3d47ba84..3c82977333 100644 --- a/openstackclient/tests/unit/compute/v2/fakes.py +++ b/openstackclient/tests/unit/compute/v2/fakes.py @@ -128,7 +128,7 @@ class FakeAggregate(object): """ if aggregates is None: aggregates = FakeAggregate.create_aggregates(count) - return mock.MagicMock(side_effect=aggregates) + return mock.Mock(side_effect=aggregates) class FakeComputev2Client(object): @@ -519,7 +519,7 @@ class FakeSecurityGroup(object): """ if security_groups is None: security_groups = FakeSecurityGroup.create_security_groups(count) - return mock.MagicMock(side_effect=security_groups) + return mock.Mock(side_effect=security_groups) class FakeSecurityGroupRule(object): @@ -649,7 +649,7 @@ class FakeServer(object): """ if servers is None: servers = FakeServer.create_servers(count) - return mock.MagicMock(side_effect=servers) + return mock.Mock(side_effect=servers) class FakeService(object): @@ -788,7 +788,7 @@ class FakeFlavor(object): """ if flavors is None: flavors = FakeFlavor.create_flavors(count) - return mock.MagicMock(side_effect=flavors) + return mock.Mock(side_effect=flavors) class FakeFlavorAccess(object): @@ -887,7 +887,7 @@ class FakeKeypair(object): """ if keypairs is None: keypairs = FakeKeypair.create_keypairs(count) - return mock.MagicMock(side_effect=keypairs) + return mock.Mock(side_effect=keypairs) class FakeAvailabilityZone(object): @@ -1011,7 +1011,7 @@ class FakeFloatingIP(object): """ if floating_ips is None: floating_ips = FakeFloatingIP.create_floating_ips(count) - return mock.MagicMock(side_effect=floating_ips) + return mock.Mock(side_effect=floating_ips) class FakeFloatingIPPool(object): diff --git a/openstackclient/tests/unit/compute/v2/test_flavor.py b/openstackclient/tests/unit/compute/v2/test_flavor.py index ace650eb18..93ad9d14c9 100644 --- a/openstackclient/tests/unit/compute/v2/test_flavor.py +++ b/openstackclient/tests/unit/compute/v2/test_flavor.py @@ -292,7 +292,7 @@ class TestFlavorDelete(TestFlavor): find_mock_result = [self.flavors[0], exceptions.CommandError] 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) diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index d4843f51c1..1081b9a3c5 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -417,7 +417,7 @@ class TestServerCreate(TestServer): @mock.patch('openstackclient.compute.v2.server.io.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.read.return_value = '#!/bin/sh' diff --git a/openstackclient/tests/unit/compute/v2/test_server_backup.py b/openstackclient/tests/unit/compute/v2/test_server_backup.py index 9aa63fc7ca..9a481e0a67 100644 --- a/openstackclient/tests/unit/compute/v2/test_server_backup.py +++ b/openstackclient/tests/unit/compute/v2/test_server_backup.py @@ -101,7 +101,7 @@ class TestServerBackupCreate(TestServerBackup): count=count, ) - self.images_mock.get = mock.MagicMock(side_effect=images) + self.images_mock.get = mock.Mock(side_effect=images) return images def test_server_backup_defaults(self): @@ -181,7 +181,7 @@ class TestServerBackupCreate(TestServerBackup): count=5, ) - self.images_mock.get = mock.MagicMock( + self.images_mock.get = mock.Mock( side_effect=images, ) @@ -230,7 +230,7 @@ class TestServerBackupCreate(TestServerBackup): count=5, ) - self.images_mock.get = mock.MagicMock( + self.images_mock.get = mock.Mock( side_effect=images, ) diff --git a/openstackclient/tests/unit/compute/v2/test_server_image.py b/openstackclient/tests/unit/compute/v2/test_server_image.py index f53f08e6e0..47bd682f17 100644 --- a/openstackclient/tests/unit/compute/v2/test_server_image.py +++ b/openstackclient/tests/unit/compute/v2/test_server_image.py @@ -99,8 +99,8 @@ class TestServerImageCreate(TestServerImage): count=count, ) - self.images_mock.get = mock.MagicMock(side_effect=images) - self.servers_mock.create_image = mock.MagicMock( + self.images_mock.get = mock.Mock(side_effect=images) + self.servers_mock.create_image = mock.Mock( return_value=images[0].id, ) return images diff --git a/openstackclient/tests/unit/compute/v2/test_service.py b/openstackclient/tests/unit/compute/v2/test_service.py index 1fd3b7d59f..8403efc9c8 100644 --- a/openstackclient/tests/unit/compute/v2/test_service.py +++ b/openstackclient/tests/unit/compute/v2/test_service.py @@ -89,7 +89,7 @@ class TestServiceDelete(TestService): delete_mock_result = [None, exceptions.CommandError] self.service_mock.delete = ( - mock.MagicMock(side_effect=delete_mock_result) + mock.Mock(side_effect=delete_mock_result) ) try: diff --git a/openstackclient/tests/unit/fakes.py b/openstackclient/tests/unit/fakes.py index 786cd6d430..f259836627 100644 --- a/openstackclient/tests/unit/fakes.py +++ b/openstackclient/tests/unit/fakes.py @@ -200,7 +200,7 @@ class FakeResource(object): returned, which looks like a function call. """ for (name, ret) in six.iteritems(methods): - method = mock.MagicMock(return_value=ret) + method = mock.Mock(return_value=ret) setattr(self, name, method) def __repr__(self): diff --git a/openstackclient/tests/unit/identity/v2_0/test_catalog.py b/openstackclient/tests/unit/identity/v2_0/test_catalog.py index c32f9fb856..65af58a24e 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_catalog.py +++ b/openstackclient/tests/unit/identity/v2_0/test_catalog.py @@ -25,12 +25,12 @@ class TestCatalog(utils.TestCommand): def setUp(self): super(TestCatalog, self).setUp() - self.sc_mock = mock.MagicMock() + self.sc_mock = mock.Mock() self.sc_mock.service_catalog.catalog.return_value = [ self.service_catalog, ] - self.auth_mock = mock.MagicMock() + self.auth_mock = mock.Mock() self.app.client_manager.session = self.auth_mock self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock diff --git a/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py b/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py index 2730695936..87643f128d 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +++ b/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py @@ -170,7 +170,7 @@ class TestRoleAssignmentList(TestRoleAssignment): 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.user_id.return_value = identity_fakes.user_id diff --git a/openstackclient/tests/unit/identity/v3/fakes.py b/openstackclient/tests/unit/identity/v3/fakes.py index 7b76fa6087..75065e657e 100644 --- a/openstackclient/tests/unit/identity/v3/fakes.py +++ b/openstackclient/tests/unit/identity/v3/fakes.py @@ -719,7 +719,7 @@ class FakeCredential(object): if credentials is None: credentials = FakeCredential.create_credentials(count) - return mock.MagicMock(side_effect=credentials) + return mock.Mock(side_effect=credentials) class FakeUser(object): @@ -819,7 +819,7 @@ class FakeGroup(object): if groups is None: groups = FakeGroup.create_groups(count) - return mock.MagicMock(side_effect=groups) + return mock.Mock(side_effect=groups) class FakeEndpoint(object): diff --git a/openstackclient/tests/unit/identity/v3/test_catalog.py b/openstackclient/tests/unit/identity/v3/test_catalog.py index 986c05f3ab..53008e8cbc 100644 --- a/openstackclient/tests/unit/identity/v3/test_catalog.py +++ b/openstackclient/tests/unit/identity/v3/test_catalog.py @@ -50,12 +50,12 @@ class TestCatalog(utils.TestCommand): def setUp(self): super(TestCatalog, self).setUp() - self.sc_mock = mock.MagicMock() + self.sc_mock = mock.Mock() self.sc_mock.service_catalog.catalog.return_value = [ self.fake_service, ] - self.auth_mock = mock.MagicMock() + self.auth_mock = mock.Mock() self.app.client_manager.session = self.auth_mock self.auth_mock.auth.get_auth_ref.return_value = self.sc_mock diff --git a/openstackclient/tests/unit/identity/v3/test_credential.py b/openstackclient/tests/unit/identity/v3/test_credential.py index fd3ae6b262..ce0fb5ae24 100644 --- a/openstackclient/tests/unit/identity/v3/test_credential.py +++ b/openstackclient/tests/unit/identity/v3/test_credential.py @@ -196,7 +196,7 @@ class TestCredentialDelete(TestCredential): delete_mock_result = [None, exceptions.CommandError] self.credentials_mock.delete = ( - mock.MagicMock(side_effect=delete_mock_result) + mock.Mock(side_effect=delete_mock_result) ) try: diff --git a/openstackclient/tests/unit/identity/v3/test_group.py b/openstackclient/tests/unit/identity/v3/test_group.py index d35e98c691..eb50adb526 100644 --- a/openstackclient/tests/unit/identity/v3/test_group.py +++ b/openstackclient/tests/unit/identity/v3/test_group.py @@ -239,7 +239,7 @@ class TestGroupDelete(TestGroup): def test_group_delete_with_domain(self): get_mock_result = [exceptions.CommandError, self.groups[0]] self.groups_mock.get = ( - mock.MagicMock(side_effect=get_mock_result)) + mock.Mock(side_effect=get_mock_result)) arglist = [ '--domain', self.domain.id, @@ -487,7 +487,7 @@ class TestGroupSet(TestGroup): def test_group_set_with_domain(self): get_mock_result = [exceptions.CommandError, self.group] self.groups_mock.get = ( - mock.MagicMock(side_effect=get_mock_result)) + mock.Mock(side_effect=get_mock_result)) arglist = [ '--domain', self.domain.id, @@ -550,7 +550,7 @@ class TestGroupShow(TestGroup): def test_group_show_with_domain(self): get_mock_result = [exceptions.CommandError, self.group] self.groups_mock.get = ( - mock.MagicMock(side_effect=get_mock_result)) + mock.Mock(side_effect=get_mock_result)) arglist = [ '--domain', self.domain.id, diff --git a/openstackclient/tests/unit/identity/v3/test_role_assignment.py b/openstackclient/tests/unit/identity/v3/test_role_assignment.py index 7102a0cdae..32fbb7f1d4 100644 --- a/openstackclient/tests/unit/identity/v3/test_role_assignment.py +++ b/openstackclient/tests/unit/identity/v3/test_role_assignment.py @@ -377,7 +377,7 @@ class TestRoleAssignmentList(TestRoleAssignment): 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.user_id.return_value = identity_fakes.user_id diff --git a/openstackclient/tests/unit/image/v1/test_image.py b/openstackclient/tests/unit/image/v1/test_image.py index c62c1ff92d..a6bc80a08e 100644 --- a/openstackclient/tests/unit/image/v1/test_image.py +++ b/openstackclient/tests/unit/image/v1/test_image.py @@ -149,7 +149,7 @@ class TestImageCreate(TestImage): @mock.patch('openstackclient.image.v1.image.io.open', name='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.read.return_value = image_fakes.image_data mock_exception = { diff --git a/openstackclient/tests/unit/image/v2/fakes.py b/openstackclient/tests/unit/image/v2/fakes.py index 4d9f645833..8e2f587d29 100644 --- a/openstackclient/tests/unit/image/v2/fakes.py +++ b/openstackclient/tests/unit/image/v2/fakes.py @@ -245,7 +245,7 @@ class FakeImage(object): if images is None: images = FakeImage.create_images(count) - return mock.MagicMock(side_effect=images) + return mock.Mock(side_effect=images) @staticmethod def get_image_columns(image=None): diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index ed30bad343..e3adb435cb 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -136,7 +136,7 @@ class FakeAddressScope(object): """ if address_scopes is None: address_scopes = FakeAddressScope.create_address_scopes(count) - return mock.MagicMock(side_effect=address_scopes) + return mock.Mock(side_effect=address_scopes) class FakeAvailabilityZone(object): @@ -344,7 +344,7 @@ class FakeNetwork(object): """ if networks is None: networks = FakeNetwork.create_networks(count) - return mock.MagicMock(side_effect=networks) + return mock.Mock(side_effect=networks) class FakeNetworkSegment(object): @@ -488,7 +488,7 @@ class FakePort(object): """ if ports is None: ports = FakePort.create_ports(count) - return mock.MagicMock(side_effect=ports) + return mock.Mock(side_effect=ports) class FakeNetworkAgent(object): @@ -555,7 +555,7 @@ class FakeNetworkAgent(object): """ if agents is None: agents = FakeNetworkAgent.create_network_agents(count) - return mock.MagicMock(side_effect=agents) + return mock.Mock(side_effect=agents) class FakeNetworkRBAC(object): @@ -625,7 +625,7 @@ class FakeNetworkRBAC(object): """ if rbac_policies is None: rbac_policies = FakeNetworkRBAC.create_network_rbacs(count) - return mock.MagicMock(side_effect=rbac_policies) + return mock.Mock(side_effect=rbac_policies) class FakeRouter(object): @@ -703,7 +703,7 @@ class FakeRouter(object): """ if routers is None: routers = FakeRouter.create_routers(count) - return mock.MagicMock(side_effect=routers) + return mock.Mock(side_effect=routers) class FakeSecurityGroup(object): @@ -776,7 +776,7 @@ class FakeSecurityGroup(object): """ if security_groups is None: security_groups = FakeSecurityGroup.create_security_groups(count) - return mock.MagicMock(side_effect=security_groups) + return mock.Mock(side_effect=security_groups) class FakeSecurityGroupRule(object): @@ -855,7 +855,7 @@ class FakeSecurityGroupRule(object): if security_group_rules is None: security_group_rules = ( 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): @@ -938,7 +938,7 @@ class FakeSubnet(object): """ if subnets is None: subnets = FakeSubnet.create_subnets(count) - return mock.MagicMock(side_effect=subnets) + return mock.Mock(side_effect=subnets) class FakeFloatingIP(object): @@ -1015,7 +1015,7 @@ class FakeFloatingIP(object): """ if floating_ips is None: floating_ips = FakeFloatingIP.create_floating_ips(count) - return mock.MagicMock(side_effect=floating_ips) + return mock.Mock(side_effect=floating_ips) class FakeSubnetPool(object): @@ -1097,4 +1097,4 @@ class FakeSubnetPool(object): """ if subnet_pools is None: subnet_pools = FakeSubnetPool.create_subnet_pools(count) - return mock.MagicMock(side_effect=subnet_pools) + return mock.Mock(side_effect=subnet_pools) diff --git a/openstackclient/tests/unit/network/v2/test_address_scope.py b/openstackclient/tests/unit/network/v2/test_address_scope.py index 6d3f40110d..12c3f1d638 100644 --- a/openstackclient/tests/unit/network/v2/test_address_scope.py +++ b/openstackclient/tests/unit/network/v2/test_address_scope.py @@ -216,7 +216,7 @@ class TestDeleteAddressScope(TestAddressScope): find_mock_result = [self._address_scopes[0], exceptions.CommandError] self.network.find_address_scope = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip.py b/openstackclient/tests/unit/network/v2/test_floating_ip.py index a40e48f4ba..a77fb24b5c 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip.py @@ -204,7 +204,7 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork): find_mock_result = [self.floating_ips[0], exceptions.CommandError] self.network.find_ip = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: @@ -454,7 +454,7 @@ class TestDeleteFloatingIPCompute(TestFloatingIPCompute): find_mock_result = [self.floating_ips[0], exceptions.CommandError] 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) diff --git a/openstackclient/tests/unit/network/v2/test_network_agent.py b/openstackclient/tests/unit/network/v2/test_network_agent.py index 2f17f41b04..9f5b442a82 100644 --- a/openstackclient/tests/unit/network/v2/test_network_agent.py +++ b/openstackclient/tests/unit/network/v2/test_network_agent.py @@ -96,7 +96,7 @@ class TestDeleteNetworkAgent(TestNetworkAgent): find_mock_result = [self.network_agents[0], exceptions.CommandError] self.network.get_agent = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_network_rbac.py b/openstackclient/tests/unit/network/v2/test_network_rbac.py index 1cd18a093f..c526ae4e4b 100644 --- a/openstackclient/tests/unit/network/v2/test_network_rbac.py +++ b/openstackclient/tests/unit/network/v2/test_network_rbac.py @@ -259,7 +259,7 @@ class TestDeleteNetworkRBAC(TestNetworkRBAC): find_mock_result = [self.rbac_policies[0], exceptions.CommandError] self.network.find_rbac_policy = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py index d5d7f3309b..92ad716eca 100644 --- a/openstackclient/tests/unit/network/v2/test_port.py +++ b/openstackclient/tests/unit/network/v2/test_port.py @@ -289,7 +289,7 @@ class TestDeletePort(TestPort): find_mock_result = [self._ports[0], exceptions.CommandError] self.network.find_port = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py index 26fe655e30..de070eb25d 100644 --- a/openstackclient/tests/unit/network/v2/test_router.py +++ b/openstackclient/tests/unit/network/v2/test_router.py @@ -263,7 +263,7 @@ class TestDeleteRouter(TestRouter): find_mock_result = [self._routers[0], exceptions.CommandError] self.network.find_router = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_security_group.py b/openstackclient/tests/unit/network/v2/test_security_group.py index 4c5b29721d..2615b77a26 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group.py +++ b/openstackclient/tests/unit/network/v2/test_security_group.py @@ -279,7 +279,7 @@ class TestDeleteSecurityGroupNetwork(TestSecurityGroupNetwork): find_mock_result = [self._security_groups[0], exceptions.CommandError] self.network.find_security_group = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: @@ -365,7 +365,7 @@ class TestDeleteSecurityGroupCompute(TestSecurityGroupCompute): find_mock_result = [self._security_groups[0], exceptions.CommandError] 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 = ( exceptions.NotFound(None)) diff --git a/openstackclient/tests/unit/network/v2/test_security_group_rule.py b/openstackclient/tests/unit/network/v2/test_security_group_rule.py index 51e18a6560..96d58e5c00 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group_rule.py +++ b/openstackclient/tests/unit/network/v2/test_security_group_rule.py @@ -723,7 +723,7 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork): find_mock_result = [ self._security_group_rules[0], exceptions.CommandError] self.network.find_security_group_rule = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: @@ -803,7 +803,7 @@ class TestDeleteSecurityGroupRuleCompute(TestSecurityGroupRuleCompute): find_mock_result = [None, exceptions.CommandError] self.compute.security_group_rules.delete = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py index e31db4693d..6d7623443d 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet.py +++ b/openstackclient/tests/unit/network/v2/test_subnet.py @@ -489,7 +489,7 @@ class TestDeleteSubnet(TestSubnet): find_mock_result = [self._subnets[0], exceptions.CommandError] self.network.find_subnet = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/network/v2/test_subnet_pool.py b/openstackclient/tests/unit/network/v2/test_subnet_pool.py index 0d9494c023..e0e1969baf 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet_pool.py +++ b/openstackclient/tests/unit/network/v2/test_subnet_pool.py @@ -310,7 +310,7 @@ class TestDeleteSubnetPool(TestSubnetPool): find_mock_result = [self._subnet_pools[0], exceptions.CommandError] self.network.find_subnet_pool = ( - mock.MagicMock(side_effect=find_mock_result) + mock.Mock(side_effect=find_mock_result) ) try: diff --git a/openstackclient/tests/unit/volume/v1/fakes.py b/openstackclient/tests/unit/volume/v1/fakes.py index 9fb6fb9b2f..2a4f62c520 100644 --- a/openstackclient/tests/unit/volume/v1/fakes.py +++ b/openstackclient/tests/unit/volume/v1/fakes.py @@ -201,7 +201,7 @@ class FakeTransfer(object): if transfers is None: transfers = FakeTransfer.create_transfers(count) - return mock.MagicMock(side_effect=transfers) + return mock.Mock(side_effect=transfers) class FakeService(object): @@ -274,7 +274,7 @@ class FakeService(object): if services is None: services = FakeService.create_services(count) - return mock.MagicMock(side_effect=services) + return mock.Mock(side_effect=services) class FakeQos(object): @@ -343,7 +343,7 @@ class FakeQos(object): if qoses is None: qoses = FakeQos.create_qoses(count) - return mock.MagicMock(side_effect=qoses) + return mock.Mock(side_effect=qoses) class FakeVolume(object): @@ -427,7 +427,7 @@ class FakeVolume(object): if volumes is None: volumes = FakeVolume.create_volumes(count) - return mock.MagicMock(side_effect=volumes) + return mock.Mock(side_effect=volumes) class FakeImagev1Client(object): @@ -547,4 +547,4 @@ class FakeType(object): if types is None: types = FakeType.create_types(count) - return mock.MagicMock(side_effect=types) + return mock.Mock(side_effect=types) diff --git a/openstackclient/tests/unit/volume/v2/fakes.py b/openstackclient/tests/unit/volume/v2/fakes.py index babdc1f7c6..8d7ac83139 100644 --- a/openstackclient/tests/unit/volume/v2/fakes.py +++ b/openstackclient/tests/unit/volume/v2/fakes.py @@ -107,7 +107,7 @@ class FakeTransfer(object): if transfers is None: transfers = FakeTransfer.create_transfers(count) - return mock.MagicMock(side_effect=transfers) + return mock.Mock(side_effect=transfers) class FakeTypeAccess(object): @@ -331,7 +331,7 @@ class FakeVolume(object): if volumes is None: volumes = FakeVolume.create_volumes(count) - return mock.MagicMock(side_effect=volumes) + return mock.Mock(side_effect=volumes) @staticmethod def get_volume_columns(volume=None): @@ -492,7 +492,7 @@ class FakeBackup(object): if backups is None: backups = FakeBackup.create_backups(count) - return mock.MagicMock(side_effect=backups) + return mock.Mock(side_effect=backups) class FakeExtension(object): @@ -623,7 +623,7 @@ class FakeQos(object): if qoses is None: qoses = FakeQos.create_qoses(count) - return mock.MagicMock(side_effect=qoses) + return mock.Mock(side_effect=qoses) class FakeSnapshot(object): @@ -696,7 +696,7 @@ class FakeSnapshot(object): if snapshots is None: snapshots = FakeSnapshot.create_snapshots(count) - return mock.MagicMock(side_effect=snapshots) + return mock.Mock(side_effect=snapshots) class FakeType(object):