Merge "Support yaml file with suffix of yml"
This commit is contained in:
commit
13952f5c03
19
toscaparser/tests/data/custom_types/wordpress.yml
Normal file
19
toscaparser/tests/data/custom_types/wordpress.yml
Normal file
@ -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
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -273,7 +273,7 @@ class ToscaTemplate(object):
|
||||
update_definitions(version)
|
||||
|
||||
def _get_path(self, path):
|
||||
if path.lower().endswith('.yaml'):
|
||||
if path.lower().endswith('.yaml') or path.lower().endswith('.yml'):
|
||||
return path
|
||||
elif path.lower().endswith(('.zip', '.csar')):
|
||||
# a CSAR archive
|
||||
|
Loading…
Reference in New Issue
Block a user