diff options
-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) |