From 25e1f60b6e30eb8832c9fd68fbe88cda3c0adaaa Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Thu, 8 Aug 2019 10:55:35 +0300 Subject: [PATCH] NSX|P: Fix broken unit tests Commit Ifcc3d76f06f79a1e850503693fbee323ab35a756 broke the unittest. This patch adds a missing mock. Change-Id: I26adf594b2255d343d133b58b78e4d9d9a330ba9 --- vmware_nsx/tests/unit/nsx_p/test_plugin.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/vmware_nsx/tests/unit/nsx_p/test_plugin.py b/vmware_nsx/tests/unit/nsx_p/test_plugin.py index e4cfc25f01..68cce95cde 100644 --- a/vmware_nsx/tests/unit/nsx_p/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_p/test_plugin.py @@ -2043,15 +2043,18 @@ class NsxPTestL3NatTestCase(NsxPTestL3NatTest, path_prefix = ("/infra/sites/default/enforcement-points/default/" "edge-clusters/") # create a router and external network - with self.router() as r, self._create_l3_ext_network() as ext_net, \ - self.subnet( - network=ext_net, cidr='10.0.1.0/24', - enable_dhcp=False) as s, mock.patch( - "vmware_nsxlib.v3.policy.core_resources." - "NsxPolicyTier1Api.get_edge_cluster_path", - return_value=False), mock.patch( - "vmware_nsxlib.v3.policy.core_resources." - "NsxPolicyTier1Api.set_edge_cluster_path") as add_srv_router: + with self.router() as r, \ + self._create_l3_ext_network() as ext_net, \ + self.subnet(network=ext_net, cidr='10.0.1.0/24', + enable_dhcp=False) as s, \ + mock.patch("vmware_nsxlib.v3.policy.core_resources." + "NsxPolicyTier1Api.get_edge_cluster_path", + return_value=False), \ + mock.patch("vmware_nsxlib.v3.policy.core_resources." + "NsxPolicyTier1Api.set_edge_cluster_path" + ) as add_srv_router,\ + mock.patch("vmware_nsxlib.v3.policy.core_resources." + "NsxPolicyTier1Api.get_realized_id"): self._add_external_gateway_to_router( r['router']['id'], s['subnet']['network_id'])