Replace 'MagicMock' with 'Mock'
Change-Id: I3f14a7932de5ce1586a9900d5d9801d1fe54c71c Closes-Bug: #1475722
This commit is contained in:
parent
791e6c984e
commit
291b31e0e5
@ -66,7 +66,7 @@ class FakeTrunk(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_trunks(trunks=None, count=2):
|
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
|
If trunks list is provided, then initialize the Mock object with the
|
||||||
list. Otherwise create one.
|
list. Otherwise create one.
|
||||||
@ -81,4 +81,4 @@ class FakeTrunk(object):
|
|||||||
"""
|
"""
|
||||||
if trunks is None:
|
if trunks is None:
|
||||||
trunks = FakeTrunk.create_trunks(count)
|
trunks = FakeTrunk.create_trunks(count)
|
||||||
return mock.MagicMock(side_effect=trunks)
|
return mock.Mock(side_effect=trunks)
|
||||||
|
@ -222,7 +222,7 @@ class TestDeleteNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
|
|||||||
|
|
||||||
get_mock_result = [self._trunks[0], exceptions.CommandError]
|
get_mock_result = [self._trunks[0], exceptions.CommandError]
|
||||||
trunk._get_id = (
|
trunk._get_id = (
|
||||||
mock.MagicMock(side_effect=get_mock_result)
|
mock.Mock(side_effect=get_mock_result)
|
||||||
)
|
)
|
||||||
with testtools.ExpectedException(exceptions.CommandError) as e:
|
with testtools.ExpectedException(exceptions.CommandError) as e:
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
@ -522,7 +522,7 @@ class TestSetNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
self.neutronclient.update_trunk = (
|
self.neutronclient.update_trunk = (
|
||||||
mock.MagicMock(side_effect=exceptions.CommandError)
|
mock.Mock(side_effect=exceptions.CommandError)
|
||||||
)
|
)
|
||||||
with testtools.ExpectedException(exceptions.CommandError) as e:
|
with testtools.ExpectedException(exceptions.CommandError) as e:
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
@ -546,7 +546,7 @@ class TestSetNetworkTrunk(test_fakes.TestNeutronClientOSCV2):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
self.neutronclient.trunk_add_subports = (
|
self.neutronclient.trunk_add_subports = (
|
||||||
mock.MagicMock(side_effect=exceptions.CommandError)
|
mock.Mock(side_effect=exceptions.CommandError)
|
||||||
)
|
)
|
||||||
with testtools.ExpectedException(exceptions.CommandError) as e:
|
with testtools.ExpectedException(exceptions.CommandError) as e:
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
@ -131,7 +131,7 @@ class CLITestV20ExtensionJSONAlternatePlurals(test_cli20.CLITestV20Base):
|
|||||||
def _mock_extension_loading(self):
|
def _mock_extension_loading(self):
|
||||||
ext_pkg = 'neutronclient.common.extension'
|
ext_pkg = 'neutronclient.common.extension'
|
||||||
contrib = mock.patch(ext_pkg + '._discover_via_entry_points').start()
|
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.IPAddress = self.IPAddress
|
||||||
ip_address.IPAddressesList = self.IPAddressesList
|
ip_address.IPAddressesList = self.IPAddressesList
|
||||||
contrib.return_value = [("ip_address", ip_address)]
|
contrib.return_value = [("ip_address", ip_address)]
|
||||||
@ -184,7 +184,7 @@ class CLITestV20ExtensionJSONChildResource(test_cli20.CLITestV20Base):
|
|||||||
def _mock_extension_loading(self):
|
def _mock_extension_loading(self):
|
||||||
ext_pkg = 'neutronclient.common.extension'
|
ext_pkg = 'neutronclient.common.extension'
|
||||||
contrib = mock.patch(ext_pkg + '._discover_via_entry_points').start()
|
contrib = mock.patch(ext_pkg + '._discover_via_entry_points').start()
|
||||||
child = mock.MagicMock()
|
child = mock.Mock()
|
||||||
child.Child = self.Child
|
child.Child = self.Child
|
||||||
child.ChildrenList = self.ChildrenList
|
child.ChildrenList = self.ChildrenList
|
||||||
child.ChildShow = self.ChildShow
|
child.ChildShow = self.ChildShow
|
||||||
|
Loading…
Reference in New Issue
Block a user