summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaili <lai.li@zte.com.cn>2018-08-17 14:22:35 +0800
committerlaili <lai.li@zte.com.cn>2018-08-17 14:22:35 +0800
commitd2dc48b3cec803261a2673cac09a7fffefd43e7e (patch)
tree5d7f188814f01b34021878126dda4fc7108aaed4
parent42a3fbcd245ae15d4fdd23ec1699c30d34a2a30e (diff)
Dealing with test related stuffs.
Add test methods to test vnf query. Change-Id: Ia54aea8d45102e90901bb46fa110d2b6d56732ce Issue-ID: VFC-1012 Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r--lcm/lcm/nf/tests/test_query_vnf.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lcm/lcm/nf/tests/test_query_vnf.py b/lcm/lcm/nf/tests/test_query_vnf.py
index ccb40c05..40151850 100644
--- a/lcm/lcm/nf/tests/test_query_vnf.py
+++ b/lcm/lcm/nf/tests/test_query_vnf.py
@@ -122,6 +122,11 @@ class ResourceTest(TestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(self.test_data_single_vnf, response.data)
+ def test_get_vnf_not_exist(self):
+ response = self.client.get("/api/vnflcm/v1/vnf_instances/x", format='json')
+ self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
+ self.assertEqual({'error': 'VnfInst(x) does not exist'}, response.data)
+
def test_get_vnfs(self):
for i in range(1, 3):
NfInstModel(nfinstid='%s' % i,
@@ -135,3 +140,8 @@ class ResourceTest(TestCase):
response = self.client.get("/api/vnflcm/v1/vnf_instances", format='json')
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.test_data_multi_vnf, response.data)
+
+ def test_get_vnfs_not_exist(self):
+ response = self.client.get("/api/vnflcm/v1/vnf_instances", format='json')
+ self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
+ self.assertEqual({'error': 'VnfInsts does not exist'}, response.data)