From 726292f65a8e7df9eb7faa4614d77a049218f665 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Tue, 29 Aug 2017 15:01:35 +0800 Subject: Add import file with suffix of yml testcases Add import file with suffix of yml testcases: 1.normal file with suffix of yml; 2.import file with suffix of yml. JIRA: PARSER-144 Change-Id: I24368f7248e782df2e57202a3129c677e1bf068f Signed-off-by: shangxdy --- .../toscaparser/tests/data/custom_types/wordpress.yml | 19 +++++++++++++++++++ .../tosca-parser/toscaparser/tests/test_toscatpl.py | 4 ++++ .../toscaparser/tests/test_toscatplvalidation.py | 12 ++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tosca2heat/tosca-parser/toscaparser/tests/data/custom_types/wordpress.yml (limited to 'tosca2heat') diff --git a/tosca2heat/tosca-parser/toscaparser/tests/data/custom_types/wordpress.yml b/tosca2heat/tosca-parser/toscaparser/tests/data/custom_types/wordpress.yml new file mode 100644 index 0000000..5899ed9 --- /dev/null +++ b/tosca2heat/tosca-parser/toscaparser/tests/data/custom_types/wordpress.yml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +node_types: + tosca.nodes.WebApplication.WordPress: + derived_from: tosca.nodes.WebApplication + requirements: + - database_endpoint: + capability: tosca.capabilities.Endpoint.Database + node: tosca.nodes.Database + relationship: tosca.relationships.ConnectsTo + interfaces: + Standard: + inputs: + wp_db_name: + type: string + wp_db_user: + type: string + wp_db_password: + type: string diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py index af35cfb..69dfb46 100644 --- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py +++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py @@ -216,6 +216,10 @@ class ToscaTemplateTest(TestCase): tosca_tpl = self._load_template('test_no_outputs_in_template.yaml') self.assertEqual(0, len(tosca_tpl.outputs)) + def test_template_file_with_suffix_yml(self): + tosca_tpl = self._load_template('custom_types/wordpress.yml') + self.assertIsNotNone(tosca_tpl) + def test_relationship_interface(self): template = ToscaTemplate(self.tosca_elk_tpl) for node_tpl in template.nodetemplates: diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py index f7c22ab..2048a83 100644 --- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py +++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py @@ -446,6 +446,18 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml self.assertTrue(custom_defs.get("mycompany.tosca.nodes." "WebApplication.WordPress")) + def test_imports_file_with_suffix_yml(self): + tpl_snippet = ''' + imports: + - custom_types/wordpress.yml + ''' + path = 'toscaparser/tests/data/tosca_elk.yaml' + custom_defs = self._imports_content_test(tpl_snippet, + path, + "node_types") + self.assertTrue(custom_defs.get("tosca.nodes." + "WebApplication.WordPress")) + def test_import_error_file_uri(self): tpl_snippet = ''' imports: -- cgit 1.2.3-korg