X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Fns%2Ftests%2Ftest_ns_create.py;h=73ea2780407d0c80ef87add54edbbfbf9481cbbd;hb=8506177af6d637ff21e72af3aa1b1ec2a4208323;hp=e462e1c338ff71910b3c7cea823709360d83ac46;hpb=32cabc9b0f505bc6275e78fbd676d067310dd8b5;p=vfc%2Fnfvo%2Flcm.git diff --git a/lcm/ns/tests/test_ns_create.py b/lcm/ns/tests/test_ns_create.py index e462e1c3..73ea2780 100644 --- a/lcm/ns/tests/test_ns_create.py +++ b/lcm/ns/tests/test_ns_create.py @@ -70,11 +70,23 @@ class TestNsInstantiate(TestCase): mock_do_biz.side_effect = NSLCMException("nsd not exists.") new_nsd_id = '1' data = { - 'nsdid': new_nsd_id, - 'nsname': 'ns', + 'csarId': new_nsd_id, + 'nsName': 'ns', 'description': 'description' } response = self.client.post("/api/nslcm/v1/ns", data=data) self.assertEqual(response.data["error"], "nsd not exists.") self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) self.assertIn("error", response.data) + + @mock.patch.object(restcall, 'call_req') + def test_create_ns_when_nsdid_not_exist(self, mock_call_req): + mock_call_req.return_value = [1, "Failed to get nsd.", '500'] + data = { + 'csarId': '1', + 'nsName': 'ns', + 'description': 'description' + } + response = self.client.post("/api/nslcm/v1/ns", data=data) + self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) + self.assertIn("error", response.data)