From fd4aa53fed5d8fbfc9dde6bbf47d1a1d63e6768b Mon Sep 17 00:00:00 2001 From: fujinhua Date: Tue, 23 Apr 2019 10:06:01 +0800 Subject: Add vnf operate ut case Change-Id: I584d8825850c7911bae4165a6a0e5c080e2aceeb Issue-ID: VFC-1306 Signed-off-by: fujinhua --- lcm/lcm/nf/tests/test_heal_vnf.py | 3 ++- lcm/lcm/nf/tests/test_operate_vnf.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lcm') diff --git a/lcm/lcm/nf/tests/test_heal_vnf.py b/lcm/lcm/nf/tests/test_heal_vnf.py index ee872edf..cae9cd32 100644 --- a/lcm/lcm/nf/tests/test_heal_vnf.py +++ b/lcm/lcm/nf/tests/test_heal_vnf.py @@ -64,7 +64,7 @@ class TestNFInstantiate(TestCase): self.failUnlessEqual(status.HTTP_409_CONFLICT, response.status_code) NfInstModel.objects.filter(nfinstid='1267').delete() - def test_change_ext_conn_inner_error(self): + def test_heal_vnf_inner_error(self): NfInstModel(nfinstid='345', nf_name='VNF1', nf_desc="VNF DESC", @@ -79,6 +79,7 @@ class TestNFInstantiate(TestCase): response = self.client.post(url, data={"additionalParams": "1"}, format='json') + NfInstModel.objects.filter(nfinstid='345').delete() self.failUnlessEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) @mock.patch.object(HealVnf, 'run') diff --git a/lcm/lcm/nf/tests/test_operate_vnf.py b/lcm/lcm/nf/tests/test_operate_vnf.py index 997f9ba0..bae92274 100644 --- a/lcm/lcm/nf/tests/test_operate_vnf.py +++ b/lcm/lcm/nf/tests/test_operate_vnf.py @@ -57,6 +57,24 @@ class TestNFOperate(TestCase): self.failUnlessEqual(status.HTTP_409_CONFLICT, response.status_code) NfInstModel(nfinstid='12', nf_name='VNF1', status='NOT_INSTANTIATED').delete() + def test_operate_vnf_inner_error(self): + NfInstModel(nfinstid='345', + nf_name='VNF1', + nf_desc="VNF DESC", + vnfdid="1", + netype="XGW", + vendor="ZTE", + vnfSoftwareVersion="V1", + version="V1", + package_id="2", + status='INSTANTIATED').save() + url = "/api/vnflcm/v1/vnf_instances/345/operate" + response = self.client.post(url, + data={}, + format='json') + NfInstModel.objects.filter(nfinstid='345').delete() + self.failUnlessEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + @mock.patch.object(OperateVnf, 'run') def test_operate_vnf_success(self, mock_run): req_data = { -- cgit 1.2.3-korg