aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-08-13 11:53:13 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2018-08-13 11:53:13 +0800
commit4dd69a8de6fe05e45e7ce898d1b0f30d56b7e63c (patch)
tree20d52daa88b97be525a7dbd0146485404440a6c1
parentac6140524faefa083871649473f1637c14b80be5 (diff)
Refactor unit test for ns heal
Change-Id: I0dc241dc05c191e3d8d086d9071c8a227c964e56 Issue-ID: VFC-1009 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/ns/tests/test_ns_heal.py40
1 files changed, 31 insertions, 9 deletions
diff --git a/lcm/ns/tests/test_ns_heal.py b/lcm/ns/tests/test_ns_heal.py
index a3b8498e..8d2f93a6 100644
--- a/lcm/ns/tests/test_ns_heal.py
+++ b/lcm/ns/tests/test_ns_heal.py
@@ -13,6 +13,7 @@
# limitations under the License.
import mock
+import json
from rest_framework import status
from django.test import TestCase
@@ -35,19 +36,40 @@ class TestHealNsViews(TestCase):
self.client = Client()
- model = '{"metadata": {"vnfdId": "1","vnfdName": "PGW001","vnfProvider": "zte","vnfdVersion": "V00001",' \
- '"vnfVersion": "V5.10.20","productType": "CN","vnfType": "PGW",' \
- '"description": "PGW VNFD description","isShared":true,"vnfExtendType":"driver"}}'
+ model = json.dumps({
+ "metadata": {
+ "vnfdId": "1",
+ "vnfdName": "PGW001",
+ "vnfProvider": "zte",
+ "vnfdVersion": "V00001",
+ "vnfVersion": "V5.10.20",
+ "productType": "CN",
+ "vnfType": "PGW",
+ "description": "PGW VNFD description",
+ "isShared": True,
+ "vnfExtendType": "driver"
+ }
+ })
+ NSInstModel.objects.filter().delete()
+ NfInstModel.objects.filter().delete()
NSInstModel(id=self.ns_inst_id, name="ns_name", status='null').save()
- NfInstModel.objects.create(nfinstid=self.nf_inst_id, nf_name='name_1', vnf_id='1',
- vnfm_inst_id='1', ns_inst_id=self.ns_inst_id,
- max_cpu='14', max_ram='12296', max_hd='101', max_shd="20", max_net=10,
- status='null', mnfinstid=self.nf_uuid, package_id='pkg1',
+ NfInstModel.objects.create(nfinstid=self.nf_inst_id,
+ nf_name='name_1',
+ vnf_id='1',
+ vnfm_inst_id='1',
+ ns_inst_id=self.ns_inst_id,
+ max_cpu='14',
+ max_ram='12296',
+ max_hd='101',
+ max_shd="20",
+ max_net=10,
+ status='null',
+ mnfinstid=self.nf_uuid,
+ package_id='pkg1',
vnfd_model=model)
def tearDown(self):
- NSInstModel.objects.filter().delete()
- NfInstModel.objects.filter().delete()
+ pass
@mock.patch.object(NSHealService, 'run')
def test_heal_vnf_url(self, mock_run):