aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-06 11:53:31 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-06 12:01:52 +0800
commit45de838b2bfcd00373c3dc3db6d58a9b8c13682f (patch)
tree5a5bf5833700a57e1d63adf76eacf78c8657a4fc
parent3b4b25bc56e049f16d72267a7617f3d8d44a7383 (diff)
Modify code because of interface
Change-Id: Ife9efd44267fc15e2199dadb2f4980bb3ea35c14 Issue-ID: VFC-784 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--lcm/ns/tests/test_ns_manual_scale.py42
1 files changed, 28 insertions, 14 deletions
diff --git a/lcm/ns/tests/test_ns_manual_scale.py b/lcm/ns/tests/test_ns_manual_scale.py
index 9fb7033b..f078631c 100644
--- a/lcm/ns/tests/test_ns_manual_scale.py
+++ b/lcm/ns/tests/test_ns_manual_scale.py
@@ -108,10 +108,15 @@ SCALING_JSON = {
class TestNsManualScale(TestCase):
def setUp(self):
self.ns_inst_id = str(uuid.uuid4())
- self.job_id = JobUtil.create_job("NS", JOB_TYPE.MANUAL_SCALE_VNF, self.ns_inst_id)
+ self.job_id = JobUtil.create_job(
+ "NS", JOB_TYPE.MANUAL_SCALE_VNF, self.ns_inst_id)
self.client = Client()
- NSInstModel(id=self.ns_inst_id, name="abc", nspackage_id="7", nsd_id="111").save()
+ NSInstModel(
+ id=self.ns_inst_id,
+ name="abc",
+ nspackage_id="7",
+ nsd_id="111").save()
def tearDown(self):
NSInstModel.objects.filter().delete()
@@ -120,15 +125,15 @@ class TestNsManualScale(TestCase):
def test_ns_manual_scale(self, mock_run):
data = {
"scaleType": "SCALE_NS",
- "scaleNsData": [{
- "scaleNsByStepsData": [{
- "aspectId": "1",
- "numberOfSteps": 1,
- "scalingDirection": "0"
- }]
- }]
+ "scaleNsByStepsData": {
+ "aspectId": "1",
+ "numberOfSteps": 1,
+ "scalingDirection": "0"
+ }
}
- response = self.client.post("/api/nslcm/v1/ns/%s/scale" % self.ns_inst_id, data=data)
+ response = self.client.post(
+ "/api/nslcm/v1/ns/%s/scale" %
+ self.ns_inst_id, data=data)
self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(restcall, 'call_req')
@@ -144,7 +149,10 @@ class TestNsManualScale(TestCase):
}]
}
NSManualScaleService(self.ns_inst_id, data, self.job_id).run()
- self.assertTrue(NSInstModel.objects.get(id=self.ns_inst_id).status, NS_INST_STATUS.ACTIVE)
+ self.assertTrue(
+ NSInstModel.objects.get(
+ id=self.ns_inst_id).status,
+ NS_INST_STATUS.ACTIVE)
def test_swagger_ok(self):
resp = self.client.get("/api/nslcm/v1/swagger.json", format='json')
@@ -153,8 +161,12 @@ class TestNsManualScale(TestCase):
@mock.patch.object(NSManualScaleService, 'start')
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={})
- self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
+ response = self.client.post(
+ "/api/nslcm/v1/ns/%s/scale" %
+ self.ns_inst_id, data={})
+ self.assertEqual(
+ response.status_code,
+ status.HTTP_500_INTERNAL_SERVER_ERROR)
self.assertIn("error", response.data)
@mock.patch.object(NSManualScaleService, 'start')
@@ -171,5 +183,7 @@ class TestNsManualScale(TestCase):
}]
}
response = self.client.post("/api/nslcm/v1/ns/11/scale", data=data)
- self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
+ self.assertEqual(
+ response.status_code,
+ status.HTTP_500_INTERNAL_SERVER_ERROR)
self.assertIn("error", response.data)