Replace 'MagicMock' with 'Mock'

MagicMock magically allow things to pass. Any usage should
be replaced with the Mock class and explicit attributes
should be set on it. [1]
[1] http://stackoverflow.com/questions/17181687/mock-vs-magicmock

Change-Id: I0e78443825c9204d180ac369d52780a2a5352a89
This commit is contained in:
gengchc2 2016-10-17 16:10:18 +08:00
parent e7e66e5484
commit a6832441c2
1 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class TestBgpDrAgent(base.BaseTestCase):
bgp_dr = bgp_dragent.BgpDrAgent(HOSTNAME)
attrs_to_mock = dict(
[(a, mock.MagicMock())
[(a, mock.Mock())
for a in ['plugin_rpc', 'sync_bgp_speaker',
'safe_configure_dragent_for_bgp_speaker',
'remove_bgp_speaker_from_dragent']])
@ -279,7 +279,7 @@ class TestBgpDrAgent(base.BaseTestCase):
bgp_dr = bgp_dragent.BgpDrAgent(HOSTNAME)
attrs_to_mock = dict(
[(a, mock.MagicMock())
[(a, mock.Mock())
for a in ['remove_bgp_peer_from_bgp_speaker',
'add_bgp_peers_to_bgp_speaker',
'advertise_routes_via_bgp_speaker',