Remove unnecessary MagicMocks in cisco unit tests
Two patches that just return static data never have assertions made on the MagicMocks generated. This replaces the magicmocks with lambdas to make the code easier to read and to get a minor performance gain. Change-Id: I064c57a66a0f7a8e3080f39cf48bd4b67cf304e3 Partial-Bug: #1316401
This commit is contained in:
parent
1cb3ccd196
commit
f28e3799bc
@ -201,17 +201,13 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
# in the background.
|
||||
|
||||
# Return a dummy VSM IP address
|
||||
get_vsm_hosts_patcher = mock.patch(n1kv_client.__name__ +
|
||||
".Client._get_vsm_hosts")
|
||||
fake_get_vsm_hosts = get_vsm_hosts_patcher.start()
|
||||
fake_get_vsm_hosts.return_value = ["127.0.0.1"]
|
||||
mock.patch(n1kv_client.__name__ + ".Client._get_vsm_hosts",
|
||||
new=lambda self: "127.0.0.1").start()
|
||||
|
||||
# Return dummy user profiles
|
||||
get_cred_name_patcher = mock.patch(cdb.__name__ +
|
||||
".get_credential_name")
|
||||
fake_get_cred_name = get_cred_name_patcher.start()
|
||||
fake_get_cred_name.return_value = {"user_name": "admin",
|
||||
"password": "admin_password"}
|
||||
mock.patch(cdb.__name__ + ".get_credential_name",
|
||||
new=lambda self: {"user_name": "admin",
|
||||
"password": "admin_password"}).start()
|
||||
|
||||
n1kv_neutron_plugin.N1kvNeutronPluginV2._setup_vsm = _fake_setup_vsm
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user