From b3a6859eb1e90b726026d0c9b61c018fe9a57ea3 Mon Sep 17 00:00:00 2001 From: Boden R Date: Mon, 19 Nov 2018 14:47:32 -0700 Subject: [PATCH] stop patching RbacNeutronDbObjectMixin No need to patch neutron.objects.rbac_db.RbacNeutronDbObjectMixin directly as the QoSPolicy OVO can be patched instead to remove the dependency on neutron for the said. This patch does just that. Change-Id: I530694c2fbb6d8394394bb6c889484b086ef7e04 --- .../tests/unit/services/qos/test_nsxv3_notification.py | 8 ++------ .../tests/unit/services/qos/test_nsxv_notification.py | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py b/vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py index 490febdb92..9d5c560152 100644 --- a/vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py +++ b/vmware_nsx/tests/unit/services/qos/test_nsxv3_notification.py @@ -94,9 +94,7 @@ class TestQosNsxV3Notification(base.BaseQosTestCase, self.nsxlib = v3_utils.get_nsxlib_wrapper() - @mock.patch( - 'neutron.objects.rbac_db.RbacNeutronDbObjectMixin' - '.create_rbac_policy') + @mock.patch.object(QoSPolicy, 'create_rbac_policy') @mock.patch.object(nsx_db, 'add_qos_policy_profile_mapping') def test_policy_create_profile(self, fake_db_add, fake_rbac_create): # test the switch profile creation when a QoS policy is created @@ -121,9 +119,7 @@ class TestQosNsxV3Notification(base.BaseQosTestCase, # verify that the policy->profile mapping entry was added self.assertTrue(fake_db_add.called) - @mock.patch( - 'neutron.objects.rbac_db.RbacNeutronDbObjectMixin' - '.create_rbac_policy') + @mock.patch.object(QoSPolicy, 'create_rbac_policy') def __test_policy_update_profile(self, *mocks): # test the switch profile update when a QoS policy is updated fields = base_object.get_updatable_fields( diff --git a/vmware_nsx/tests/unit/services/qos/test_nsxv_notification.py b/vmware_nsx/tests/unit/services/qos/test_nsxv_notification.py index ff3ef2e513..6c1c56e533 100644 --- a/vmware_nsx/tests/unit/services/qos/test_nsxv_notification.py +++ b/vmware_nsx/tests/unit/services/qos/test_nsxv_notification.py @@ -280,9 +280,8 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase, with mock.patch('neutron.services.qos.qos_plugin.QoSPlugin.' 'get_policy', return_value=_policy) as rules_mock,\ - mock.patch('neutron.objects.qos.policy.' - 'QosPolicy.get_object', - return_value=_policy),\ + mock.patch.object(QosPolicy, 'get_object', + return_value=_policy),\ mock.patch.object(self.ctxt.session, 'expunge'): # create the network to use this policy net = self._create_net()