diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-09-23 09:40:41 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-09-23 09:40:41 +0800 |
commit | abb68dc5834e408dd50a463180b4f2642502cfc2 (patch) | |
tree | 44382e0e7755ff983b2058d1989319fe2888d277 | |
parent | efdeb2380eabba94c916aa56091a29fe0b29a559 (diff) |
Add UT cases for nsd parse
Change-Id: I1147e4491d876896a7c1d82880c29c9b4924822e
Issue-id: VFC-437
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | catalog/packages/tests/test_ns.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py index de4555e1..605679f4 100644 --- a/catalog/packages/tests/test_ns.py +++ b/catalog/packages/tests/test_ns.py @@ -482,6 +482,21 @@ class TestNsPackage(TestCase): "downloadUrl": "http://127.0.0.1:8806/static/catalog/14/14.csar" }}, resp.data) + ############################################################################################################### + + @mock.patch.object(toscaparser, 'parse_nsd') + def test_nsd_parse(self, mock_parse_nsd): + NSPackageModel(nsPackageId="18", nsdId="12").save() + mock_parse_nsd.return_value = json.JSONEncoder().encode({"a": "b"}) + resp = self.client.post("/api/catalog/v1/parsernsd", + {"csarId": "18", "inputs": []}, format='json') + self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED) + self.assertEqual({"model": '{"a": "b"}'}, resp.data) + + + + + |