fix swagger error 90/83690/2
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Fri, 29 Mar 2019 09:37:29 +0000 (17:37 +0800)
committermaopeng zhang <zhang.maopeng1@zte.com.cn>
Fri, 29 Mar 2019 09:38:24 +0000 (09:38 +0000)
fix swagger error

Change-Id: Ief33b3e3bbcf567f469e1cf015ffe9ed75740f36
Issue-ID: VFC-1059
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/ns/views/sol/heal_ns_view.py
lcm/ns/views/sol/instantiate_ns_views.py
lcm/ns/views/sol/ns_instances_views.py
lcm/ns/views/sol/scale_ns_views.py
lcm/ns/views/sol/terminate_ns_view.py
lcm/ns/views/sol/update_ns_view.py
lcm/swagger/tests.py

index 278418f..6c844e1 100644 (file)
@@ -30,7 +30,7 @@ class HealNSView(APIView):
     @swagger_auto_schema(
         request_body=HealNsReqSerializer(),
         responses={
-            status.HTTP_202_ACCEPTED: None,
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
             status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
index 8a04c4b..8b8318d 100644 (file)
@@ -31,7 +31,7 @@ class InstantiateNsView(APIView):
     @swagger_auto_schema(
         request_body=InstantNsReqSerializer(),
         responses={
-            status.HTTP_202_ACCEPTED: None,
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
             status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
index a81e20f..6fcae3f 100644 (file)
@@ -135,7 +135,7 @@ class IndividualNsInstanceView(APIView):
     @swagger_auto_schema(
         request_body=None,
         responses={
-            status.HTTP_204_NO_CONTENT: None
+            status.HTTP_204_NO_CONTENT: "HTTP_204_NO_CONTENT"
         }
     )
     def delete(self, request, ns_instance_id):
index 570195d..8a5c19d 100644 (file)
@@ -32,7 +32,7 @@ class ScaleNSView(APIView):
     @swagger_auto_schema(
         request_body=ManualScaleNsReqSerializer(help_text="NS Scale"),
         responses={
-            status.HTTP_202_ACCEPTED: None,
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
             status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
index e5e072a..438ca61 100644 (file)
@@ -35,7 +35,7 @@ class TerminateNsView(APIView):
     @swagger_auto_schema(
         request_body=TerminateNsReqSerializer(),
         responses={
-            status.HTTP_202_ACCEPTED: None,
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
             status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
index 91b916d..1657867 100644 (file)
@@ -33,7 +33,7 @@ class UpdateNSView(APIView):
     @swagger_auto_schema(
         request_body=UpdateNsReqSerializer(),
         responses={
-            status.HTTP_202_ACCEPTED: None,
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
             status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
index 9bc1cef..bc0c040 100644 (file)
@@ -8,20 +8,22 @@
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# import json
+from django.test import TestCase
 
-import unittest
-
-from django.test import Client
+from rest_framework.test import APIClient
 # from rest_framework import status
 
 
-class SwaggerViewTest(unittest.TestCase):
+class SwaggerViewTest(TestCase):
     def setUp(self):
-        self.client = Client()
+        self.client = APIClient()
 
     def tearDown(self):
         pass
 
-    # test_swagger(self):
-    # response = self.client.get("/api/nslcm/v1/swagger.json")
-    # self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+    # def test_swagger(self):
+    #  response = self.client.get("/api/nslcm/v1/swagger.json")
+    #  self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+    #  with open('vfc.json', 'w') as swagger_file:
+    #      swagger_file.write(json.dumps(response.data))