diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-03-06 13:43:15 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-03-06 13:43:15 +0800 |
commit | 4838e8ab8a6bea05609cd3d54a7db22166342642 (patch) | |
tree | af47495d63370b63d5a3d59b67eb0215911e78fd | |
parent | c2bb047964b547c5c3aa72bc867abdcdc3b56a01 (diff) |
Add a new test case
Change-Id: I00d7c4d2b37d766f3eec2ef89257e3c578048516
Issue-ID: VFC-784
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | lcm/pub/tests/test_scaleaspect.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lcm/pub/tests/test_scaleaspect.py b/lcm/pub/tests/test_scaleaspect.py index 35fda1de..2fec1785 100644 --- a/lcm/pub/tests/test_scaleaspect.py +++ b/lcm/pub/tests/test_scaleaspect.py @@ -1,11 +1,14 @@ from django.test import TestCase +from lcm.pub.utils.scaleaspect import get_scale_vnf_data_package from lcm.pub.utils.scaleaspect import get_vnf_scale_info_package from lcm.pub.utils.scaleaspect import get_vnf_data_package from lcm.pub.utils.scaleaspect import get_json_data from lcm.pub.database.models import NfInstModel from lcm.pub.database.models import NSInstModel +from lcm.pub.msapi import catalog from lcm.pub.utils.timeutil import now_time import os +import mock class TestScaleAspect(TestCase): @@ -20,6 +23,12 @@ class TestScaleAspect(TestCase): self.initInstModel() + self.scaleNsData = { + "aspectId": "TIC_EDGE_IMS", + "numberOfSteps": "1", + "scalingDirection": "UP" + } + def initInstModel(self): self.nsd_id = "23" self.ns_inst_id = "1" @@ -107,3 +116,12 @@ class TestScaleAspect(TestCase): self.scaling_map_json, "23", "TIC_EDGE_IMS", "1") self.assertIsNotNone(scale_vnf_info_list) self.assertEqual(2, scale_vnf_info_list.__len__()) + + @mock.patch.object(catalog, 'get_scalingmap_json_package') + def test_get_scale_vnf_data_package( + self, mock_get_scalingmap_json_package): + mock_get_scalingmap_json_package.return_value = self.scaling_map_json + + scale_vnf_data = get_scale_vnf_data_package(self.scaleNsData, "1") + self.assertIsNotNone(scale_vnf_data) + self.assertEqual(2, scale_vnf_data.__len__()) |