From 6c2727e2cef7f0fc1de5f02189689f7daad7c12b Mon Sep 17 00:00:00 2001 From: maopengzhang Date: Mon, 17 Sep 2018 18:21:24 +0800 Subject: Solve NSD Sonar Problem Solve NSD Sonar Problem in Catalog Change-Id: I1d3ed3de8e73d9f5218f62e7b21a8d4898740892 Issue-ID: VFC-635 Signed-off-by: maopengzhang --- catalog/pub/utils/toscaparser/tests.py | 34 +++++++++++++++++----------------- 1 file 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): -- cgit 1.2.3-korg