Fix occ in ns_sol test case 39/83939/1
authoryangyan <yangyanyj@chinamobile.com>
Tue, 2 Apr 2019 08:39:47 +0000 (16:39 +0800)
committeryangyan <yangyanyj@chinamobile.com>
Tue, 2 Apr 2019 08:39:58 +0000 (16:39 +0800)
Change-Id: Ie03827d242c3af1481559fb71eaca85a561c9f3c
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Issue-ID: VFC-1331

lcm/ns/tests/test_sol_ns_heal_api.py
lcm/ns/tests/test_sol_ns_scale_api.py
lcm/ns/tests/test_sol_ns_terminate_api.py

index 8ff4ced..ebd8ba0 100644 (file)
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 import json
+import uuid
 
 import mock
 from django.test import Client
@@ -28,7 +29,8 @@ from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
 class TestHealNsApi(TestCase):
     def setUp(self):
         self.url = "/api/nslcm/v1/ns_instances/%s/heal"
-        self.ns_inst_id = '1'
+        # self.ns_inst_id = '1'
+        self.ns_inst_id = str(uuid.uuid4())
         self.nf_inst_id = '1'
         self.nf_uuid = '1-1-1'
 
@@ -93,6 +95,8 @@ class TestHealNsApi(TestCase):
         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code, response.data)
         self.assertIsNotNone(response.data)
         self.assertIsNotNone(response['Location'])
+        response = self.client.get(response['Location'], format='json')
+        self.assertEqual(response.status_code, status.HTTP_200_OK)
 
     # add healNsData
 
@@ -117,6 +121,8 @@ class TestHealNsApi(TestCase):
         response = self.client.post(self.url % self.ns_inst_id, data=data)
         self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code, response.data)
         self.assertIsNotNone(response['Location'])
+        response = self.client.get(response['Location'], format='json')
+        self.assertEqual(response.status_code, status.HTTP_200_OK)
 
     @mock.patch.object(NSHealService, "start")
     def test_heal_vnf_non_existing_ns(self, mock_start):
index c484a88..9d4ed93 100644 (file)
@@ -198,6 +198,8 @@ class TestScaleNsApi(TestCase):
         response = self.client.post(self.url % self.ns_inst_id, data=data)
         self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
         self.assertIsNotNone(response['Location'])
+        response = self.client.get(response['Location'], format='json')
+        self.assertEqual(response.status_code, status.HTTP_200_OK)
 
     @mock.patch.object(NSManualScaleService, 'start')
     def test_ns_manual_scale_empty_data(self, mock_start):
index 44de00e..5aec52e 100644 (file)
@@ -25,7 +25,8 @@ class TestTerminateNsApi(TestCase):
     def setUp(self):
         self.client = Client()
         self.url = "/api/nslcm/v1/ns_instances/%s/terminate"
-        self.ns_inst_id = '1'
+        # self.ns_inst_id = '1'
+        self.ns_inst_id = str(uuid.uuid4())
         self.nf_inst_id = '1'
         self.vnffg_id = str(uuid.uuid4())
         self.vim_id = str(uuid.uuid4())
@@ -62,6 +63,8 @@ class TestTerminateNsApi(TestCase):
         response = self.client.post(self.url % self.ns_inst_id, data=req_data)
         self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
         self.assertIsNotNone(response['Location'])
+        response = self.client.get(response['Location'], format='json')
+        self.assertEqual(response.status_code, status.HTTP_200_OK)
 
     def test_method_not_allowed(self):
         response = self.client.put(self.url % '1', data={}, format='json')