diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-26 10:28:00 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-26 10:28:00 +0800 |
commit | c2da75032a9972e0d31e4e06bd4d1cbb85d85bca (patch) | |
tree | c2b632862761db6ec8bfaf02be90128085f596b5 | |
parent | e1ce061efe39b054d0d7a1259d5d5f420900fdb7 (diff) |
Fix query vnf test cases
Change-Id: Ieca458e6ba3b14ae2e332d924fbafa6a254fad6d
Issue-ID: VFC-1306
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/lcm/nf/tests/test_query_vnf.py | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lcm/lcm/nf/tests/test_query_vnf.py b/lcm/lcm/nf/tests/test_query_vnf.py index 88d4402b..66673f6b 100644 --- a/lcm/lcm/nf/tests/test_query_vnf.py +++ b/lcm/lcm/nf/tests/test_query_vnf.py @@ -151,23 +151,50 @@ class ResourceTest(TestCase): def test_get_vnf_net_not_exist(self): vnf_inst_id = "1" - NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save() - VLInstModel(ownerid=vnf_inst_id, relatednetworkid='x', ownertype='0').save() + NfInstModel(nfinstid=vnf_inst_id, + nf_name='VNF1', + vnfdid="1", + netype="XGW", + vendor="ZTE", + vnfSoftwareVersion="V1", + version="V1", + package_id="2", + status='INSTANTIATED').save() + VLInstModel(ownerid=vnf_inst_id, + relatednetworkid='x', + ownertype='0').save() response = self.client.get("/api/vnflcm/v1/vnf_instances/%s" % vnf_inst_id, format='json') self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) self.assertEqual({'error': 'NetworkInst(x) does not exist.'}, response.data) def test_get_vnf_vm_not_exist(self): vnf_inst_id = "1" - NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save() - VNFCInstModel(instid=vnf_inst_id, vmid='x').save() + NfInstModel(nfinstid=vnf_inst_id, + nf_name='VNF1', + vnfdid="1", + netype="XGW", + vendor="ZTE", + vnfSoftwareVersion="V1", + version="V1", + package_id="2", + status='INSTANTIATED').save() + VNFCInstModel(instid=vnf_inst_id, + vmid='x').save() response = self.client.get("/api/vnflcm/v1/vnf_instances/%s" % vnf_inst_id, format='json') self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) self.assertEqual({'error': 'VmInst(x) does not exist.'}, response.data) def test_get_vnf_storage_not_exist(self): vnf_inst_id = "1" - NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save() + NfInstModel(nfinstid=vnf_inst_id, + nf_name='VNF1', + vnfdid="1", + netype="XGW", + vendor="ZTE", + vnfSoftwareVersion="V1", + version="V1", + package_id="2", + status='INSTANTIATED').save() VNFCInstModel(instid=vnf_inst_id, vmid='x',).save() VmInstModel(vmid='x', insttype='0').save() |