NSX-V3| fix unittests mock
NSX-lib changed some resources locations Change-Id: I0a2d8466f177de4eb2be594a075ea9b2a7eb50fe
This commit is contained in:
parent
1d92ca7c84
commit
4aac83661a
@ -98,15 +98,17 @@ def _mock_nsx_backend_calls():
|
|||||||
side_effect=_return_id_key).start()
|
side_effect=_return_id_key).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibBridgeCluster.get_id_by_name_or_id",
|
"vmware_nsxlib.v3.core_resources.NsxLibBridgeCluster."
|
||||||
|
"get_id_by_name_or_id",
|
||||||
return_value=uuidutils.generate_uuid()).start()
|
return_value=uuidutils.generate_uuid()).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibTransportZone.get_id_by_name_or_id",
|
"vmware_nsxlib.v3.core_resources.NsxLibTransportZone."
|
||||||
|
"get_id_by_name_or_id",
|
||||||
return_value=uuidutils.generate_uuid()).start()
|
return_value=uuidutils.generate_uuid()).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibBridgeEndpoint.create",
|
"vmware_nsxlib.v3.core_resources.NsxLibBridgeEndpoint.create",
|
||||||
side_effect=_return_id_key).start()
|
side_effect=_return_id_key).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
@ -114,15 +116,17 @@ def _mock_nsx_backend_calls():
|
|||||||
).start()
|
).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibLogicalSwitch.create",
|
"vmware_nsxlib.v3.core_resources.NsxLibLogicalSwitch.create",
|
||||||
side_effect=_return_id_key).start()
|
side_effect=_return_id_key).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibDhcpProfile.get_id_by_name_or_id",
|
"vmware_nsxlib.v3.core_resources.NsxLibDhcpProfile."
|
||||||
|
"get_id_by_name_or_id",
|
||||||
return_value=NSX_DHCP_PROFILE_ID).start()
|
return_value=NSX_DHCP_PROFILE_ID).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibMetadataProxy.get_id_by_name_or_id",
|
"vmware_nsxlib.v3.core_resources.NsxLibMetadataProxy."
|
||||||
|
"get_id_by_name_or_id",
|
||||||
side_effect=_return_same).start()
|
side_effect=_return_same).start()
|
||||||
|
|
||||||
mock.patch(
|
mock.patch(
|
||||||
|
@ -92,7 +92,7 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
def test_policy_create_profile(self, fake_db_add, fake_rbac_create):
|
def test_policy_create_profile(self, fake_db_add, fake_rbac_create):
|
||||||
# test the switch profile creation when a QoS policy is created
|
# test the switch profile creation when a QoS policy is created
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.create',
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.create',
|
||||||
return_value=self.fake_profile
|
return_value=self.fake_profile
|
||||||
) as create_profile:
|
) as create_profile:
|
||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
@ -120,7 +120,7 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
fields = base_object.get_updatable_fields(
|
fields = base_object.get_updatable_fields(
|
||||||
policy_object.QosPolicy, self.policy_data['policy'])
|
policy_object.QosPolicy, self.policy_data['policy'])
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update'
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.update'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=self.policy):
|
return_value=self.policy):
|
||||||
@ -151,7 +151,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update_shaping'
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'update_shaping'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
with mock.patch('neutron.objects.db.api.update_object',
|
with mock.patch('neutron.objects.db.api.update_object',
|
||||||
return_value=self.rule_data):
|
return_value=self.rule_data):
|
||||||
@ -194,7 +195,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update_shaping'
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'update_shaping'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
with mock.patch('neutron.objects.db.api.update_object',
|
with mock.patch('neutron.objects.db.api.update_object',
|
||||||
return_value=rule_data):
|
return_value=rule_data):
|
||||||
@ -236,7 +238,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update_shaping'
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'update_shaping'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
with mock.patch('neutron.objects.db.api.update_object',
|
with mock.patch('neutron.objects.db.api.update_object',
|
||||||
return_value=rule_data):
|
return_value=rule_data):
|
||||||
@ -268,7 +271,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update_shaping'
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'update_shaping'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
with mock.patch('neutron.objects.db.api.'
|
with mock.patch('neutron.objects.db.api.'
|
||||||
'update_object', return_value=self.dscp_rule_data):
|
'update_object', return_value=self.dscp_rule_data):
|
||||||
@ -300,7 +304,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
with mock.patch('neutron.objects.qos.policy.QosPolicy.get_object',
|
||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
"vmware_nsxlib.v3.NsxLibQosSwitchingProfile.update_shaping"
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'update_shaping'
|
||||||
) as update_profile:
|
) as update_profile:
|
||||||
setattr(_policy, "rules", [self.rule])
|
setattr(_policy, "rules", [self.rule])
|
||||||
self.qos_plugin.delete_policy_bandwidth_limit_rule(
|
self.qos_plugin.delete_policy_bandwidth_limit_rule(
|
||||||
@ -320,7 +325,8 @@ class TestQosNsxV3Notification(base.BaseQosTestCase,
|
|||||||
def test_policy_delete_profile(self, *mocks):
|
def test_policy_delete_profile(self, *mocks):
|
||||||
# test the switch profile deletion when a QoS policy is deleted
|
# test the switch profile deletion when a QoS policy is deleted
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'vmware_nsxlib.v3.NsxLibQosSwitchingProfile.delete',
|
'vmware_nsxlib.v3.core_resources.NsxLibQosSwitchingProfile.'
|
||||||
|
'delete',
|
||||||
return_value=self.fake_profile
|
return_value=self.fake_profile
|
||||||
) as delete_profile:
|
) as delete_profile:
|
||||||
self.qos_plugin.delete_policy(self.ctxt, self.policy.id)
|
self.qos_plugin.delete_policy(self.ctxt, self.policy.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user