From 1e4ba0f074a64476adee70866fcf8f5dd7bfdc80 Mon Sep 17 00:00:00 2001 From: biancunkang Date: Thu, 16 Aug 2018 09:01:28 +0800 Subject: [PATCH] Add a test in Grand Change-Id: I17020da4555a77fe59914ab1573a6d5ee7fd86bc Issue-ID: VFC-1015 Signed-off-by: biancunkang --- lcm/v2/tests.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/lcm/v2/tests.py b/lcm/v2/tests.py index 996852f1..d665a1e4 100644 --- a/lcm/v2/tests.py +++ b/lcm/v2/tests.py @@ -110,6 +110,63 @@ class VnfGrantViewTest(unittest.TestCase): } self.assertEqual(expect_resp_data, resp_data) + def test_grant_vnf_when_vnfinst_not_exist(self): + data = { + "vnfInstanceId": "1", + "vnfLcmOpOccId": "2", + "vnfdId": "3", + "flavourId": "4", + "operation": "INSTANTIATE", + "isAutomaticInvocation": True, + "instantiationLevelId": "5", + "addResources": [ + { + "id": "1", + "type": "COMPUTE", + "vduId": "2", + "resourceTemplateId": "3", + } + ], + "placementConstraints": [ + { + "affinityOrAntiAffinity": "AFFINITY", + "scope": "NFVI_POP", + "resource": [ + { + "idType": "RES_MGMT", + "resourceId": "1", + "vimConnectionId": "2", + "resourceProviderId": "3" + } + ] + } + ], + "vimConstraints": [ + { + "sameResourceGroup": True, + "resource": [ + { + "idType": "RES_MGMT", + "resourceId": "1", + "vimConnectionId": "2", + "resourceProviderId": "3" + } + ] + } + ], + "additionalParams": {}, + "_links": { + "vnfLcmOpOcc": { + "href": "1" + }, + "vnfInstance": { + "href": "2" + } + } + } + response = self.client.post("/api/nslcm/v2/grants", data=data, format='json') + self.failUnlessEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + def test_get_notify_vnf_normal(self): response = self.client.get("/api/nslcm/v2/ns/1/vnfs/1/Notify") self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content) -- 2.16.6