From 0461281fc32a84415d0375b3b62feb11e6aa8f52 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Wed, 10 Jul 2019 11:49:08 +0800 Subject: [PATCH] Refactor codes for manual scale ns Change-Id: I6d8b1adaa23a37ca26026320979b5d1ec9f3835e Issue-ID: VFC-1429 Signed-off-by: fujinhua --- lcm/ns/tests/test_ns_manual_scale.py | 4 ++-- lcm/ns/views/deprecated/common.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lcm/ns/tests/test_ns_manual_scale.py b/lcm/ns/tests/test_ns_manual_scale.py index e4c3c71f..4c31611b 100644 --- a/lcm/ns/tests/test_ns_manual_scale.py +++ b/lcm/ns/tests/test_ns_manual_scale.py @@ -131,7 +131,7 @@ class TestNsManualScale(TestCase): mock_start.side_effect = NSLCMException("NS scale failed.") response = self.client.post("/api/nslcm/v1/ns/%s/scale" % self.ns_inst_id, data={}, format='json') self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) - self.assertIn("detail", response.data) + self.assertIn("error", response.data) @mock.patch.object(NSManualScaleService, 'start') def test_ns_manual_scale_when_ns_not_exist(self, mock_start): @@ -139,4 +139,4 @@ class TestNsManualScale(TestCase): scale_ns_json = SCALE_NS_DICT.copy() response = self.client.post("/api/nslcm/v1/ns/11/scale", data=scale_ns_json, format='json') self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) - self.assertIn("detail", response.data) + self.assertIn("error", response.data) diff --git a/lcm/ns/views/deprecated/common.py b/lcm/ns/views/deprecated/common.py index ac1d312c..379a9481 100644 --- a/lcm/ns/views/deprecated/common.py +++ b/lcm/ns/views/deprecated/common.py @@ -27,8 +27,7 @@ logger = logging.getLogger(__name__) def make_error_resp(status, detail): return Response( data={ - 'status': status, - 'detail': detail + 'error': detail }, status=status ) -- 2.16.6