diff options
author | 2017-09-21 13:53:29 +0800 | |
---|---|---|
committer | 2017-09-21 13:53:29 +0800 | |
commit | ae0ef170004ebc397c070efdad99e24b1e24d3d9 (patch) | |
tree | e5d3e2377940600785ca44b587813cc7d25ae366 | |
parent | 9a8b9e13f9dedda58fe68905976493d16961edfc (diff) |
Add tests of deleting nf by force
Change-Id: Ia7dc6785fde683aecbceffbe7f7138634397daf4
Issue-Id: VFC-406
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/packages/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/catalog/packages/tests.py b/catalog/packages/tests.py index b3a59757..55adfca4 100644 --- a/catalog/packages/tests.py +++ b/catalog/packages/tests.py @@ -215,6 +215,23 @@ class PackageTest(unittest.TestCase): self.assert_nfmodel_result("bb",0) self.assert_job_result("6", 100, "Delete CSAR(bb) successfully.") + @mock.patch.object(NfDistributeThread, 'get_vnfd') + @mock.patch.object(nslcm,'get_vnfInstances') + def test_nf_package_delete_force(self,mock_get_vnfInstances,mock_get_vnfd): + # First distribute a VNF + local_file_name = "/url/local/filename" + vnfd = json.JSONEncoder().encode(vnfd_json) + mock_get_vnfd.return_value = vnfd_json,local_file_name,vnfd + + NfDistributeThread("bb", ["1"], "1", "5").run() + self.assert_job_result("5", 100, "CSAR(bb) distribute successfully.") + self.assert_nfmodel_result("bb",1) + + # Then delete the package by force + NfPkgDeleteThread("bb", "6", True).run() + self.assert_nfmodel_result("bb",0) + self.assert_job_result("6", 100, "Delete CSAR(bb) successfully.") + def assert_job_result(self, job_id, job_progress, job_detail): jobs = JobStatusModel.objects.filter( jobid=job_id, |