diff options
author | yangyan <yangyanyj@chinamobile.com> | 2019-08-19 14:57:19 +0800 |
---|---|---|
committer | yangyan <yangyanyj@chinamobile.com> | 2019-08-19 14:57:25 +0800 |
commit | 869c70e55d47605c9033ff232a5595d299ec04c8 (patch) | |
tree | e1394c2fa1740998e42a43490f64011303c9c6d2 | |
parent | eb77fcbe0ecefe2153ff4267ff0d28e6a17bd193 (diff) |
add test for create ns if no csar id
Change-Id: I0ffa704fe9454b95a1e9485e997ce17b587ba342
Issue-ID: VFC-1489
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rw-r--r-- | lcm/ns/tests/test_ns_create.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lcm/ns/tests/test_ns_create.py b/lcm/ns/tests/test_ns_create.py index ef00a6e1..7531c8d2 100644 --- a/lcm/ns/tests/test_ns_create.py +++ b/lcm/ns/tests/test_ns_create.py @@ -80,3 +80,10 @@ class TestNsInstantiate(TestCase): response = self.client.post("/api/nslcm/v1/ns", data=self.create_ns_dict, format='json') 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_ns_csar_no_exist(self, mock_call_req): + mock_call_req.return_value = [1, "Failed query ns csar file", 500] + response = self.client.post("/api/nslcm/v1/ns", data={"csarId": ''}, format='json') + self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR) + self.assertIn("error", response.data) |