Update vfc lcm unit tests 15/9615/2
authorying.yunlong <ying.yunlong@zte.com.cn>
Thu, 31 Aug 2017 07:02:46 +0000 (15:02 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Thu, 31 Aug 2017 07:06:49 +0000 (15:06 +0800)
Update vfc lcm heal and
terminate unit tests.

Change-Id: Id8a8789664b3e3cf607b9435d35dbd96dbe56ad6
Issue-ID: VFC-199
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/ns/tests/test_ns_heal.py
lcm/ns/tests/test_ns_instant.py
lcm/ns/tests/tests_ns_terminate.py

index 0d77dbc..e47f5f4 100644 (file)
@@ -97,10 +97,6 @@ class TestHealNsViews(TestCase):
         NSHealService(self.ns_inst_id, data, self.job_id).run()
         self.assertEqual(NSInstModel.objects.get(id=self.ns_inst_id).status, NS_INST_STATUS.HEALING)
 
-    def test_swagger_ok(self):
-        resp = self.client.get("/api/nslcm/v1/swagger.json", format='json')
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
-
     @mock.patch.object(NSHealService, "start")
     def test_ns_heal_non_existing_ns(self, mock_start):
         mock_start.side_effect = NSLCMException("NS Not Found")
index 955284c..77fb7f3 100644 (file)
@@ -60,6 +60,6 @@ class TestNsInstant(TestCase):
         self.assertEqual(resp.status_code, status.HTTP_200_OK)
     """
     
-    def test_swagger_ok(self):
-        resp = self.client.get("/api/nslcm/v1/swagger.json", format='json')
-        self.assertEqual(resp.status_code, status.HTTP_200_OK)
+    def test_swagger_ok(self):
+        resp = self.client.get("/api/nslcm/v1/swagger.json", format='json')
+        self.assertEqual(resp.status_code, status.HTTP_200_OK)
index b12a456..5251c1d 100644 (file)
@@ -49,8 +49,9 @@ class TestTerminateNsViews(TestCase):
         NSInstModel.objects.all().delete()
         NfInstModel.objects.all().delete()
 
-    @mock.patch.object(TerminateNsService, 'do_biz')
+    @mock.patch.object(TerminateNsService, 'run')
     def test_terminate_vnf_url(self, mock_run):
+        mock_run.re.return_value = None
         req_data = {
             "terminationType": "forceful",
             "gracefulTerminationTimeout": "600"}
@@ -60,7 +61,7 @@ class TestTerminateNsViews(TestCase):
         response = self.client.delete("/api/nslcm/v1/ns/%s" % self.ns_inst_id)
         self.failUnlessEqual(status.HTTP_204_NO_CONTENT, response.status_code)
 
-    @mock.patch.object(restcall, "call_req")
+    @mock.patch.object(restcall, 'call_req')
     def test_terminate_vnf(self, mock_call_req):
         job_id = JobUtil.create_job("VNF", JOB_TYPE.TERMINATE_VNF, self.nf_inst_id)
 
@@ -90,7 +91,7 @@ class TestTerminateNsViews(TestCase):
 
         mock_call_req.side_effect = side_effect
 
-        TerminateNsService(self.nf_inst_id, "forceful", "600", job_id).start()
+        TerminateNsService(self.nf_inst_id, "forceful", "600", job_id).run()
         nsinst = NSInstModel.objects.get(id=self.ns_inst_id)
         if nsinst:
             self.assertTrue(1, 0)