Fix for test_remove_vnf failing in Heal VDU 92/12192/1
authorelumalai <deepika.e@tataelxsi.co.in>
Fri, 10 Jun 2022 09:58:49 +0000 (15:28 +0530)
committerelumalai <deepika.e@tataelxsi.co.in>
Fri, 10 Jun 2022 10:03:58 +0000 (15:33 +0530)
Change-Id: I0283d3d2c1f709f991d07fac7276cba1244bbd6b
Signed-off-by: elumalai <deepika.e@tataelxsi.co.in>
osm_lcm/tests/test_ns.py

index 4234562..5e248a2 100644 (file)
@@ -797,16 +797,17 @@ class TestMyNS(asynctest.TestCase):
         nsr_id = descriptors.test_ids["TEST-UPDATE"]["ns"]
         nslcmop_id = descriptors.test_ids["TEST-UPDATE"]["removeVnf"]
         vnf_instance_id = descriptors.test_ids["TEST-UPDATE"]["vnf"]
-        self.my_ns.RO.status = asynctest.CoroutineMock(self.my_ns.RO.status, side_effect=self._ro_status("update"))
-        await self.my_ns.update(nsr_id, nslcmop_id)
-        expected_value = "COMPLETED"
-        return_value = self.db.get_one("nslcmops", {"_id": nslcmop_id}).get(
-            "operationState"
-        )
-        self.assertEqual(return_value, expected_value)
-        with self.assertRaises(Exception) as context:
-            self.db.get_one("vnfrs", {"_id": vnf_instance_id})
-        self.assertTrue("database exception Not found entry with filter" in str(context.exception))
+        mock_wait_ng_ro = asynctest.CoroutineMock()
+        with patch("osm_lcm.ns.NsLcm._wait_ng_ro", mock_wait_ng_ro):
+            await self.my_ns.update(nsr_id, nslcmop_id)
+            expected_value = "COMPLETED"
+            return_value = self.db.get_one("nslcmops", {"_id": nslcmop_id}).get(
+                "operationState"
+            )
+            self.assertEqual(return_value, expected_value)
+            with self.assertRaises(Exception) as context:
+                self.db.get_one("vnfrs", {"_id": vnf_instance_id})
+            self.assertTrue("database exception Not found entry with filter" in str(context.exception))
 
     # async def test_instantiate_pdu(self):
     #     nsr_id = descriptors.test_ids["TEST-A"]["ns"]