diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-07-11 08:38:25 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-07-11 08:50:16 +0800 |
commit | 16377f0f673d1aba03c1c286faf24ca8a5d97b5b (patch) | |
tree | 9e8d47bbce4ac3c8163b53ade03841b4ddd21977 | |
parent | 182dfa236e88f28eb4a6748f39f003f52499dfb4 (diff) |
Fix bugs for manual scale ns
Change-Id: I40b6c6fbc4c92d8364e7026e7ebd0e1be78a1c3e
Issue-ID: VFC-1429
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/ns/tests/test_ns_manual_scale.py | 2 | ||||
-rw-r--r-- | lcm/ns/views/deprecated/scale_ns_views.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lcm/ns/tests/test_ns_manual_scale.py b/lcm/ns/tests/test_ns_manual_scale.py index 4c31611b..e25b4460 100644 --- a/lcm/ns/tests/test_ns_manual_scale.py +++ b/lcm/ns/tests/test_ns_manual_scale.py @@ -130,7 +130,7 @@ class TestNsManualScale(TestCase): def test_ns_manual_scale_empty_data(self, mock_start): 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.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertIn("error", response.data) @mock.patch.object(NSManualScaleService, 'start') diff --git a/lcm/ns/views/deprecated/scale_ns_views.py b/lcm/ns/views/deprecated/scale_ns_views.py index a260ce85..cef1e531 100644 --- a/lcm/ns/views/deprecated/scale_ns_views.py +++ b/lcm/ns/views/deprecated/scale_ns_views.py @@ -22,6 +22,7 @@ from lcm.ns.biz.ns_manual_scale import NSManualScaleService from lcm.ns.serializers.deprecated.ns_serializers import _NsOperateJobSerializer from lcm.ns.serializers.deprecated.ns_serializers import _ManualScaleNsReqSerializer from lcm.pub.exceptions import NSLCMException +from lcm.pub.exceptions import BadRequestException from lcm.pub.utils.jobutil import JobUtil from lcm.jobs.enum import JOB_TYPE, JOB_ACTION from .common import view_safe_call_with_log @@ -42,7 +43,7 @@ class NSManualScaleView(APIView): logger.debug("Enter NSManualScaleView::post %s, %s", request.data, ns_instance_id) req_serializer = _ManualScaleNsReqSerializer(data=request.data) if not req_serializer.is_valid(): - raise NSLCMException(req_serializer.errors) + raise BadRequestException(req_serializer.errors) req = request.data scale_data = {} |