diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2019-03-29 17:37:29 +0800 |
---|---|---|
committer | maopeng zhang <zhang.maopeng1@zte.com.cn> | 2019-03-29 09:38:24 +0000 |
commit | 0876c326a9f9809fbb35d512a4a95f9fad00e445 (patch) | |
tree | 14e8cbdb8cc6776d76e76f94af2fed299fac5c9f | |
parent | 7ad91bb2cbcb385183c4dfa71194fabcaf81ec07 (diff) |
fix swagger error
fix swagger error
Change-Id: Ief33b3e3bbcf567f469e1cf015ffe9ed75740f36
Issue-ID: VFC-1059
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r-- | lcm/ns/views/sol/heal_ns_view.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/sol/instantiate_ns_views.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/sol/ns_instances_views.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/sol/scale_ns_views.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/sol/terminate_ns_view.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/sol/update_ns_view.py | 2 | ||||
-rw-r--r-- | lcm/swagger/tests.py | 18 |
7 files changed, 16 insertions, 14 deletions
diff --git a/lcm/ns/views/sol/heal_ns_view.py b/lcm/ns/views/sol/heal_ns_view.py index 278418f4..6c844e12 100644 --- a/lcm/ns/views/sol/heal_ns_view.py +++ b/lcm/ns/views/sol/heal_ns_view.py @@ -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() } ) diff --git a/lcm/ns/views/sol/instantiate_ns_views.py b/lcm/ns/views/sol/instantiate_ns_views.py index 8a04c4b9..8b8318da 100644 --- a/lcm/ns/views/sol/instantiate_ns_views.py +++ b/lcm/ns/views/sol/instantiate_ns_views.py @@ -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() } ) diff --git a/lcm/ns/views/sol/ns_instances_views.py b/lcm/ns/views/sol/ns_instances_views.py index a81e20f6..6fcae3ff 100644 --- a/lcm/ns/views/sol/ns_instances_views.py +++ b/lcm/ns/views/sol/ns_instances_views.py @@ -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): diff --git a/lcm/ns/views/sol/scale_ns_views.py b/lcm/ns/views/sol/scale_ns_views.py index 570195d7..8a5c19d5 100644 --- a/lcm/ns/views/sol/scale_ns_views.py +++ b/lcm/ns/views/sol/scale_ns_views.py @@ -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() } ) diff --git a/lcm/ns/views/sol/terminate_ns_view.py b/lcm/ns/views/sol/terminate_ns_view.py index e5e072a7..438ca619 100644 --- a/lcm/ns/views/sol/terminate_ns_view.py +++ b/lcm/ns/views/sol/terminate_ns_view.py @@ -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() } ) diff --git a/lcm/ns/views/sol/update_ns_view.py b/lcm/ns/views/sol/update_ns_view.py index 91b916db..1657867b 100644 --- a/lcm/ns/views/sol/update_ns_view.py +++ b/lcm/ns/views/sol/update_ns_view.py @@ -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() } ) diff --git a/lcm/swagger/tests.py b/lcm/swagger/tests.py index 9bc1cef5..bc0c0409 100644 --- a/lcm/swagger/tests.py +++ b/lcm/swagger/tests.py @@ -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)) |