diff options
author | Olivia2047 <zhan.jie1@zte.com.cn> | 2018-02-06 09:02:04 +0800 |
---|---|---|
committer | Olivia2047 <zhan.jie1@zte.com.cn> | 2018-02-06 09:02:04 +0800 |
commit | 9910f563a5c74072ce03e65e699b7bd49e16af62 (patch) | |
tree | 268f425b50c53db8f09122aac6ac5ad8bccd01af | |
parent | 7d0473f60049147f1149963ff507095891577527 (diff) |
Optimize the returned values
Change-Id: I9c615e040c2a1a719a3adcd0c956365c4d5b50ba
Issue-ID: VFC-735
Signed-off-by: Olivia2047 <zhan.jie1@zte.com.cn>
-rw-r--r-- | gvnfmadapter/driver/interfaces/tests.py | 4 | ||||
-rw-r--r-- | gvnfmadapter/driver/interfaces/views.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py index b29aec6..21a83b2 100644 --- a/gvnfmadapter/driver/interfaces/tests.py +++ b/gvnfmadapter/driver/interfaces/tests.py @@ -257,7 +257,7 @@ class InterfacesTest(TestCase): mock_call_req.return_value = [0, json.JSONEncoder().encode(vim_info), '201'] response = self.client.put("/api/gvnfmdriver/v1/resource/grant", data=json.dumps(req_data), content_type='application/json') - self.assertEqual(str(status.HTTP_201_CREATED), response.status_code) + self.assertEqual(status.HTTP_201_CREATED, response.status_code) expect_resp_data = { "vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e", "tenant": "admin" @@ -332,7 +332,7 @@ class InterfacesTest(TestCase): response = self.client.post("/api/gvnfmdriver/v1/vnfs/lifecyclechangesnotification", data=json.dumps(req_data), content_type='application/json') - self.assertEqual(str(status.HTTP_200_OK), response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) expect_resp_data = None self.assertEqual(expect_resp_data, response.data) diff --git a/gvnfmadapter/driver/interfaces/views.py b/gvnfmadapter/driver/interfaces/views.py index 8a33e47..de7d496 100644 --- a/gvnfmadapter/driver/interfaces/views.py +++ b/gvnfmadapter/driver/interfaces/views.py @@ -200,7 +200,7 @@ def grantvnf(request, *args, **kwargs): 'tenant': ignorcase_get(accessinfo, 'tenant') } logger.debug("[%s]resp_data=%s", fun_name(), resp_data) - return Response(data=resp_data, status=ret[2]) + return Response(data=resp_data, status=status.HTTP_201_CREATED) except GvnfmDriverException as e: logger.error('Grant vnf failed, detail message: %s' % e.message) return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) @@ -219,7 +219,7 @@ def notify(request, *args, **kwargs): if ret[0] != 0: logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) raise GvnfmDriverException('Failed to notify vnf.') - return Response(data=None, status=ret[2]) + return Response(data=None, status=status.HTTP_200_OK) except GvnfmDriverException as e: logger.error('Grant vnf failed, detail message: %s' % e.message) return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) |