NSX|V3: Fix broken unit tests
Commit Ibad52cca60131e970447536fd22c4f4440c66d34 groke the unit tests by removing a mock that is needed by the plugin tests. Adding back the mock in the plugin tests context. Change-Id: I85c191c3c15aedc0740cb3c23990c0ea0b646fe7
This commit is contained in:
parent
625485c6e8
commit
d1f41da8b5
@ -96,6 +96,18 @@ def _return_id_key_list(*args, **kwargs):
|
|||||||
return [{'id': uuidutils.generate_uuid()}]
|
return [{'id': uuidutils.generate_uuid()}]
|
||||||
|
|
||||||
|
|
||||||
|
def _mock_add_rules_in_section(*args):
|
||||||
|
# NOTE(arosen): the code in the neutron plugin expects the
|
||||||
|
# neutron rule id as the display_name.
|
||||||
|
rules = args[0]
|
||||||
|
return {
|
||||||
|
'rules': [
|
||||||
|
{'display_name': rule['display_name'],
|
||||||
|
'id': uuidutils.generate_uuid()}
|
||||||
|
for rule in rules
|
||||||
|
]}
|
||||||
|
|
||||||
|
|
||||||
def _mock_nsx_backend_calls():
|
def _mock_nsx_backend_calls():
|
||||||
mock.patch("vmware_nsxlib.v3.client.NSX3Client").start()
|
mock.patch("vmware_nsxlib.v3.client.NSX3Client").start()
|
||||||
|
|
||||||
@ -189,6 +201,9 @@ def _mock_nsx_backend_calls():
|
|||||||
"get_transport_zones",
|
"get_transport_zones",
|
||||||
return_value=[NSX_TZ_NAME, mock.ANY]).start()
|
return_value=[NSX_TZ_NAME, mock.ANY]).start()
|
||||||
|
|
||||||
|
mock.patch("vmware_nsxlib.v3.security.NsxLibFirewallSection.add_rules",
|
||||||
|
side_effect=_mock_add_rules_in_section).start()
|
||||||
|
|
||||||
|
|
||||||
class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
|
class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
|
||||||
nsxlib_testcase.NsxClientTestCase):
|
nsxlib_testcase.NsxClientTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user