diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2018-09-17 18:21:24 +0800 |
---|---|---|
committer | maopengzhang <zhang.maopeng1@zte.com.cn> | 2018-09-17 18:21:24 +0800 |
commit | 6c2727e2cef7f0fc1de5f02189689f7daad7c12b (patch) | |
tree | 6f4e71c71366cada58d45acce025b9783d334fab | |
parent | 5ae41760c1641e84b9e9d32a10f684c040a5fec5 (diff) |
Solve NSD Sonar Problem
Solve NSD Sonar Problem in Catalog
Change-Id: I1d3ed3de8e73d9f5218f62e7b21a8d4898740892
Issue-ID: VFC-635
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r-- | catalog/pub/utils/toscaparser/tests.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/catalog/pub/utils/toscaparser/tests.py b/catalog/pub/utils/toscaparser/tests.py index 39be7f64..e6f47939 100644 --- a/catalog/pub/utils/toscaparser/tests.py +++ b/catalog/pub/utils/toscaparser/tests.py @@ -31,23 +31,6 @@ class TestToscaparser(TestCase): def tearDown(self): pass - def test_nsd_parse(self): - self.remove_temp_dir() - ran_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/ns/ran.csar" - nsd_json = parse_nsd(ran_csar) - metadata = json.loads(nsd_json).get("metadata") - self.assertEqual("RAN-NS", metadata.get("template_name", "")) - - pnf_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/pnf/ran-du.csar" - nsd_json = parse_nsd(pnf_csar) - metadata = json.loads(nsd_json).get("metadata") - self.assertNotEqual("RAN-NS", metadata.get("template_name", "")) - - pnf_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf/vgw.csar" - nsd_json = parse_nsd(pnf_csar) - metadata = json.loads(nsd_json).get("metadata") - self.assertNotEqual("RAN-NS", metadata.get("template_name", "")) - def test_vnf_parse(self): self.remove_temp_dir() csar_path = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf" @@ -68,6 +51,23 @@ class TestToscaparser(TestCase): metadata = json.loads(pnfd_json).get("metadata") self.assertEqual("RAN_DU", metadata.get("template_name", "")) + def test_nsd_parse(self): + self.remove_temp_dir() + pnf_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/pnf/ran-du.csar" + nsd_json = parse_nsd(pnf_csar) + metadata = json.loads(nsd_json).get("metadata") + self.assertNotEqual("RAN-NS", metadata.get("template_name", "")) + + pnf_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf/vgw.csar" + nsd_json = parse_nsd(pnf_csar) + metadata = json.loads(nsd_json).get("metadata") + self.assertNotEqual("RAN-NS", metadata.get("template_name", "")) + + ran_csar = os.path.dirname(os.path.abspath(__file__)) + "/testdata/ns/ran.csar" + nsd_json = parse_nsd(ran_csar) + metadata = json.loads(nsd_json).get("metadata") + self.assertEqual("RAN-NS", metadata.get("template_name", "")) + def remove_temp_dir(self): tempdir = tempfile.gettempdir() for dir in os.listdir(tempdir): |