summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-04-23 10:06:01 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-04-23 10:06:01 +0800
commitfd4aa53fed5d8fbfc9dde6bbf47d1a1d63e6768b (patch)
treec63c87502c50210885c78272f10ba9d9042e0216 /lcm
parente6e870a0e3cb7293802e990882bb91a0cacc97fe (diff)
Add vnf operate ut case
Change-Id: I584d8825850c7911bae4165a6a0e5c080e2aceeb Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/tests/test_heal_vnf.py3
-rw-r--r--lcm/lcm/nf/tests/test_operate_vnf.py18
2 files changed, 20 insertions, 1 deletions
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 = {