Replace 'MagicMock' with 'Mock'

Change-Id: I3f14a7932de5ce1586a9900d5d9801d1fe54c71c
Closes-Bug: #1475722
This commit is contained in:
lilintan 2016-09-22 18:48:57 +08:00
parent 791e6c984e
commit 291b31e0e5
3 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ class FakeTrunk(object):
@staticmethod
def get_trunks(trunks=None, count=2):
"""Get an iterable MagicMock object with a list of faked trunks.
"""Get an iterable Mock object with a list of faked trunks.
If trunks list is provided, then initialize the Mock object with the
list. Otherwise create one.
@ -81,4 +81,4 @@ class FakeTrunk(object):
"""
if trunks is None:
trunks = FakeTrunk.create_trunks(count)
return mock.MagicMock(side_effect=trunks)
return mock.Mock(side_effect=trunks)

View File

@ -222,7 +222,7 @@ class TestDeleteNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
get_mock_result = [self._trunks[0], exceptions.CommandError]
trunk._get_id = (
mock.MagicMock(side_effect=get_mock_result)
mock.Mock(side_effect=get_mock_result)
)
with testtools.ExpectedException(exceptions.CommandError) as e:
self.cmd.take_action(parsed_args)
@ -522,7 +522,7 @@ class TestSetNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.neutronclient.update_trunk = (
mock.MagicMock(side_effect=exceptions.CommandError)
mock.Mock(side_effect=exceptions.CommandError)
)
with testtools.ExpectedException(exceptions.CommandError) as e:
self.cmd.take_action(parsed_args)
@ -546,7 +546,7 @@ class TestSetNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.neutronclient.trunk_add_subports = (
mock.MagicMock(side_effect=exceptions.CommandError)
mock.Mock(side_effect=exceptions.CommandError)
)
with testtools.ExpectedException(exceptions.CommandError) as e:
self.cmd.take_action(parsed_args)

View File

@ -131,7 +131,7 @@ class CLITestV20ExtensionJSONAlternatePlurals(test_cli20.CLITestV20Base):
def _mock_extension_loading(self):
ext_pkg = 'neutronclient.common.extension'
contrib = mock.patch(ext_pkg + '._discover_via_entry_points').start()
ip_address = mock.MagicMock()
ip_address = mock.Mock()
ip_address.IPAddress = self.IPAddress
ip_address.IPAddressesList = self.IPAddressesList
contrib.return_value = [("ip_address", ip_address)]
@ -184,7 +184,7 @@ class CLITestV20ExtensionJSONChildResource(test_cli20.CLITestV20Base):
def _mock_extension_loading(self):
ext_pkg = 'neutronclient.common.extension'
contrib = mock.patch(ext_pkg + '._discover_via_entry_points').start()
child = mock.MagicMock()
child = mock.Mock()
child.Child = self.Child
child.ChildrenList = self.ChildrenList
child.ChildShow = self.ChildShow