ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject incubator-ariatosca git commit: More tests.
Date Wed, 27 Sep 2017 22:40:44 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-1-parser-test-suite 9fe6e7cdd -> 62bb9f321


More tests.

* Support Unicode keys in TOSCA map
* Repository can work without importing profile


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/62bb9f32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/62bb9f32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/62bb9f32

Branch: refs/heads/ARIA-1-parser-test-suite
Commit: 62bb9f3216ba484b52895d59cd04dceb4bcb566d
Parents: 9fe6e7c
Author: Tal Liron <tal.liron@gmail.com>
Authored: Wed Sep 27 17:39:54 2017 -0500
Committer: Tal Liron <tal.liron@gmail.com>
Committed: Wed Sep 27 17:39:54 2017 -0500

----------------------------------------------------------------------
 .../simple_v1_0/data_types.py                   |   2 +-
 .../aria_extension_tosca/simple_v1_0/misc.py    |   4 +
 .../simple_v1_0/modeling/data_types.py          |  16 +-
 .../templates/common/test_template_interface.py |  28 +-
 .../test_node_template_artifacts.py             | 325 +++++++++++++++++++
 .../simple_v1_0/test_dsl_definitions.py         |  42 +++
 .../simple_v1_0/test_imports.py                 |  64 +++-
 .../simple_v1_0/test_repositories.py            | 179 ++++++++++
 .../simple_v1_0/test_service_template.py        |   9 -
 .../types/common/test_type_interfaces.py        |  24 +-
 .../types/node_type/test_node_type_artifacts.py | 202 +++++++++++-
 .../node_type/test_node_type_requirements.py    |  52 +--
 .../simple_v1_0/types/test_artifact_type.py     |  12 +
 .../simple_v1_0/types/test_interface_type.py    |  21 +-
 14 files changed, 881 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/extensions/aria_extension_tosca/simple_v1_0/data_types.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/data_types.py
index 4c781e7..b85caa1 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/data_types.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/data_types.py
@@ -345,7 +345,7 @@ class Map(StrictDict):
         return the_map
 
     def __init__(self, items=None):
-        super(Map, self).__init__(items, key_class=str)
+        super(Map, self).__init__(items, key_class=basestring)
 
     # Can't define as property because it's old-style Python class
     def as_raw(self):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/extensions/aria_extension_tosca/simple_v1_0/misc.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/misc.py b/extensions/aria_extension_tosca/simple_v1_0/misc.py
index 4002f0c..914691e 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/misc.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/misc.py
@@ -138,6 +138,10 @@ class Repository(ExtensiblePresentation):
     def _get_credential(self, context):
         return get_data_type_value(context, self, 'credential', 'tosca.datatypes.Credential')
 
+    def _validate(self, context):
+        super(Repository, self)._validate(context)
+        self._get_credential(context)
+
 
 @short_form_field('file')
 @has_fields

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py
index d739a2f..25e53c6 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py
@@ -318,15 +318,15 @@ def apply_constraint_to_value(context, presentation, constraint_clause,
value):
 #
 
 def get_data_type_value(context, presentation, field_name, type_name):
-    the_type = get_type_by_name(context, type_name, 'data_types')
-    if the_type is not None:
-        value = getattr(presentation, field_name)
-        if value is not None:
+    value = getattr(presentation, field_name)
+    if value is not None:
+        the_type = get_type_by_name(context, type_name, 'data_types')
+        if the_type is not None:
             return coerce_data_type_value(context, presentation, the_type, None, None, value,
None)
-    else:
-        context.validation.report(u'field "{0}" in "{1}" refers to unknown data type "{2}"'
-                                  .format(field_name, presentation._fullname, type_name),
-                                  locator=presentation._locator, level=Issue.BETWEEN_TYPES)
+        else:
+            context.validation.report(u'field "{0}" in "{1}" refers to unknown data type
"{2}"'
+                                      .format(field_name, presentation._fullname, type_name),
+                                      locator=presentation._locator, level=Issue.BETWEEN_TYPES)
     return None
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py
index a6a857e..08025f6 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py
@@ -621,8 +621,13 @@ MyInterface:
 """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success()
 
 
-@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
-def test_template_interface_operation_implementation_short_form(parser, macros, name):
+@pytest.mark.parametrize('macros,name,value', matrix(
+    INTERFACE_SECTIONS,
+    data.NOT_A_STRING,
+    counts=(2, 1)
+))
+def test_template_interface_operation_implementation_primary_syntax_type(parser, macros,
name,
+                                                                         value):
     parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{- additions() }}
@@ -642,18 +647,14 @@ topology_template:
 {%- call interfaces() %}
 MyInterface:
   my_operation:
-    implementation: an implementation
+    implementation:
+      primary: {{ value }}
 {% endcall %}
-""", dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success()
+""", dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('macros,name,value', matrix(
-    INTERFACE_SECTIONS,
-    data.NOT_A_STRING,
-    counts=(2, 1)
-))
-def test_template_interface_operation_implementation_primary_syntax_type(parser, macros,
name,
-                                                                         value):
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_template_interface_operation_implementation_primary_short_form(parser, macros, name):
     parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{- additions() }}
@@ -673,10 +674,9 @@ topology_template:
 {%- call interfaces() %}
 MyInterface:
   my_operation:
-    implementation:
-      primary: {{ value }}
+    implementation: an implementation
 {% endcall %}
-""", dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure()
+""", dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success()
 
 
 @pytest.mark.parametrize('macros,name,value', matrix(

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/templates/node_template/test_node_template_artifacts.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/node_template/test_node_template_artifacts.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/node_template/test_node_template_artifacts.py
index 8ca2ef7..322f3c2 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/node_template/test_node_template_artifacts.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/node_template/test_node_template_artifacts.py
@@ -13,3 +13,328 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+
+import pytest
+
+from ... import data
+
+
+# Artifacts section
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_node_template_artifacts_section_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifacts_section_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts: {}
+""").assert_success()
+
+
+# Artifact
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_node_template_artifact_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_syntax_unsupported(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          unsupported: {}
+""").assert_failure()
+
+
+def test_node_template_artifact_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact: {} # "type" and "file" are required
+""").assert_failure()
+
+
+# Type
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_template_artifact_type_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: {{ value }}
+          file: a file
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_type_unknown(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: UnknownType
+          file: a file
+""").assert_failure()
+
+
+# File
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_template_artifact_file_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_file(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+""").assert_success()
+
+
+# Description
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_template_artifact_description_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          description: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_description(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          description: a description
+""").assert_success()
+
+
+# Repository
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_template_artifact_repository_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          repository: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_repository_unknown(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          repository: unknown
+""").assert_failure()
+
+
+def test_node_template_artifact_repository(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          repository: my_repository
+""").assert_success()
+
+
+# Deploy path
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_template_artifact_deploy_path_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          deploy_path: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_template_artifact_deploy_path(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType: {}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      artifacts:
+        my_artifact:
+          type: MyType
+          file: a file
+          deploy_path: a path
+""").assert_success()
+
+
+# Unicode
+
+def test_node_template_artifact_unicode(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  知識庫:
+    url: 網址
+artifact_types:
+  類型: {}
+node_types:
+  類型: {}
+topology_template:
+  node_templates:
+    模板:
+      type: 類型
+      artifacts:
+        神器:
+          type: 類型
+          file: 文件
+          repository: 知識庫
+          deploy_path: 路徑
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/test_dsl_definitions.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_dsl_definitions.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_dsl_definitions.py
new file mode 100644
index 0000000..9bb526e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_dsl_definitions.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+def test_dsl_definitions_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+dsl_definitions: {}
+""").assert_success()
+
+
+def test_dsl_definitions(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+dsl_definitions:
+  dsl_definition: &ANCHOR
+    field: a value
+""").assert_success()
+
+
+# Unicode
+
+def test_dsl_definitions_unicode(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+dsl_definitions:
+  定義: &ANCHOR # YAML does not allow the anchor name to be Unicode
+    領域: 值
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/test_imports.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_imports.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_imports.py
index 0b80d0e..9636b7b 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_imports.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_imports.py
@@ -59,24 +59,52 @@ imports: {{ value }}
 """, dict(value=value)).assert_failure()
 
 
-def test_imports_section_syntax_unsupported(parser):
+def test_imports_section_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports: []
+""").assert_success()
+
+
+# Import
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_import_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_import_syntax_unsupported(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
-  unsupported: {}
+  - unsupported: {}
 """).assert_failure()
 
 
-def test_imports_section_syntax_empty(parser):
+def test_import_syntax_empty(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
-imports: []
-""").assert_success()
+imports:
+  - {} # "file" is required
+""").assert_failure()
+
+
+# File
 
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_import_file_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - file: {{ value }}
+""", dict(value=value)).assert_failure()
 
-# Variants
 
-def test_imports_short_form(parser, repository):
+def test_import_file_short_form(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
@@ -88,7 +116,7 @@ topology_template:
 """, dict(repository=repository)).assert_success()
 
 
-def test_imports_long_form(parser, repository):
+def test_import_file(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
@@ -100,16 +128,18 @@ topology_template:
 """, dict(repository=repository)).assert_success()
 
 
+# Repository
+
 @pytest.mark.skip(reason='not yet supported')
-def test_imports_repository(parser, repository):
+def test_import_repository(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 repositories:
-  myrepository:
+  my_repository:
     url: {{ repository }}/imports/
 imports:
   - file: node-type.yaml
-    repository: myrepository
+    repository: my_repository
 topology_template:
   node_templates:
     my_node:
@@ -117,8 +147,10 @@ topology_template:
 """, dict(repository=repository)).assert_success()
 
 
+# Namespace
+
 @pytest.mark.skip(reason='not yet supported')
-def test_imports_namespace(parser, repository):
+def test_import_namespace(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
@@ -134,7 +166,7 @@ topology_template:
 
 # Bad imports
 
-def test_imports_not_found(parser):
+def test_import_not_found(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
@@ -142,7 +174,7 @@ imports:
 """).assert_failure()
 
 
-def test_imports_bad(parser, repository):
+def test_import_bad(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
@@ -156,13 +188,13 @@ topology_template:
 
 # Unicode
 
-def test_imports_unicode(parser, repository):
+def test_import_unicode(parser, repository):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
   - {{ repository }}/imports/節點類型.yaml
 topology_template:
   node_templates:
-    my_node:
+    模板:
       type: 類型
 """, dict(repository=repository)).assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/test_repositories.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_repositories.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_repositories.py
new file mode 100644
index 0000000..9d40e22
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_repositories.py
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import pytest
+
+from . import data
+
+
+# Repositories section
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_repositories_section_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_repositories_section_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories: {}
+""").assert_success()
+
+
+# Repository
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_repository_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_repository_syntax_unsupported(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    unsupported: {}
+""").assert_failure()
+
+
+def test_repository_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository: {} # "url" is required
+""").assert_failure()
+
+
+# Description
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_repository_description_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    description: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_repository_description(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    description: a description
+""").assert_success()
+
+
+# URL
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_repository_url_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_repository_url_short_form(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository: a url
+""").assert_success()
+
+
+# Credential
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_repository_credential_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    credential: {{ value }}
+""", dict(value=value), import_profile=True).assert_failure()
+
+
+def test_repository_credential_syntax_unsupported(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    credential:
+      unsupported: {}
+""", import_profile=True).assert_failure()
+
+
+def test_repository_credential_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    credential: {}
+""", import_profile=True).assert_success()
+
+
+def test_repository_credential_full(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+    credential:
+      protocol: a protocol
+      token_type: a token type
+      token: a token
+      keys:
+        key1: value1
+        key2: value2
+      user: a user
+""", import_profile=True).assert_success()
+
+
+# Unicode
+
+def test_repository_unicode(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  知識庫:
+    url: 網址
+    description: 描述
+    credential:
+      protocol: 協議
+      token_type: 類型
+      token: 代幣
+      keys:
+        鍵一: 值
+        鍵二: 值
+      user: 用戶
+""", import_profile=True).assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py
index 38a2947..2bcd018 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py
@@ -20,12 +20,3 @@ def test_service_template_syntax_unsupported(parser):
 tosca_definitions_version: tosca_simple_yaml_1_0
 unsupported: {}
 """).assert_failure()
-
-
-# DSL definitions
-
-def test_service_template_dsl_definitions(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-dsl_definitions: {}
-""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
index e3bde9b..85ca47b 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
@@ -333,8 +333,11 @@ MyInterface:
 """, dict(name=name)).assert_success()
 
 
-@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
-def test_type_interface_operation_implementation_short_form(parser, macros, name):
+@pytest.mark.parametrize('macros,name,value', matrix(
+    INTERFACE_SECTIONS, data.NOT_A_STRING,
+    counts=(2, 1)
+))
+def test_type_interface_operation_implementation_primary_syntax_type(parser, macros, name,
value):
     parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{- additions() }}
@@ -346,16 +349,14 @@ interface_types:
 MyInterface:
   type: MyType
   my_operation:
-    implementation: an implementation
+    implementation:
+      primary: {{ value }}
 {% endcall %}
-""", dict(name=name)).assert_success()
+""", dict(name=name, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('macros,name,value', matrix(
-    INTERFACE_SECTIONS, data.NOT_A_STRING,
-    counts=(2, 1)
-))
-def test_type_interface_operation_implementation_primary_syntax_type(parser, macros, name,
value):
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_operation_implementation_primary_short_form(parser, macros, name):
     parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{- additions() }}
@@ -367,10 +368,9 @@ interface_types:
 MyInterface:
   type: MyType
   my_operation:
-    implementation:
-      primary: {{ value }}
+    implementation: an implementation
 {% endcall %}
-""", dict(name=name, value=value)).assert_failure()
+""", dict(name=name)).assert_success()
 
 
 @pytest.mark.parametrize('macros,name,value', matrix(

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_artifacts.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_artifacts.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_artifacts.py
index 0c28d5a..b67b5e6 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_artifacts.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_artifacts.py
@@ -19,6 +19,9 @@ import pytest
 from ... import data
 
 
+# TODO: properties
+
+
 # Artifacts section
 
 @pytest.mark.parametrize('value', data.NOT_A_DICT)
@@ -63,6 +66,7 @@ node_types:
     artifacts:
       my_artifact:
         type: MyType
+        file: a file
         unsupported: {}
 """).assert_failure()
 
@@ -73,5 +77,201 @@ tosca_definitions_version: tosca_simple_yaml_1_0
 node_types:
   MyType:
     artifacts:
-      my_artifact: {} # "type" is required
+      my_artifact: {} # "type" and "file" are required
+""").assert_failure()
+
+
+# Type
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_artifact_type_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: {{ value }}
+        file: a file
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_artifact_type_unknown(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: UnknownType
+        file: a file
+""").assert_failure()
+
+
+# File
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_artifact_file_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_artifact_file(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+""").assert_success()
+
+
+# Description
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_artifact_description_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        description: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_artifact_description(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        description: a description
+""").assert_success()
+
+
+# Repository
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_artifact_repository_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        repository: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_artifact_repository_unknown(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        repository: unknown
 """).assert_failure()
+
+
+def test_node_type_artifact_repository(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  my_repository:
+    url: a url
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        repository: my_repository
+""").assert_success()
+
+
+# Deploy path
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_artifact_deploy_path_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        deploy_path: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_artifact_deploy_path(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  MyType: {}
+node_types:
+  MyType:
+    artifacts:
+      my_artifact:
+        type: MyType
+        file: a file
+        deploy_path: a path
+""").assert_success()
+
+
+# Unicode
+
+def test_node_type_artifact_unicode(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+repositories:
+  知識庫:
+    url: 網址
+artifact_types:
+  類型: {}
+node_types:
+  類型:
+    artifacts:
+      神器:
+        type: 類型
+        file: 文件
+        repository: 知識庫
+        deploy_path: 路徑
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py
index 710bd22..22917e4 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py
@@ -105,29 +105,29 @@ node_types:
 """).assert_failure()
 
 
-def test_node_type_requirement_capability_short_form(parser):
+# Capability type
+
+def test_node_type_requirement_capability_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
 node_types:
   MyType:
     requirements:
-      - my_requirement: MyType
-""").assert_success()
-
+      - my_requirement:
+          capability: UnknownType
+""").assert_failure()
 
-# Capability type
 
-def test_node_type_requirement_capability_type_unknown(parser):
+def test_node_type_requirement_capability_type_short_form(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
 node_types:
   MyType:
     requirements:
-      - my_requirement:
-          capability: UnknownType
-""").assert_failure()
+      - my_requirement: MyType
+""").assert_success()
 
 
 def test_node_type_requirement_capability_type_override(parser):
@@ -234,26 +234,25 @@ node_types:
 """).assert_failure()
 
 
-def test_node_type_requirement_relationship_short_form(parser):
+# Relationship type
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_node_type_requirement_relationship_type_syntax_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
   MyType: {}
-relationship_types:
-  MyType: {}
 node_types:
   MyType:
     requirements:
       - my_requirement:
           capability: MyType
-          relationship: MyType
-""").assert_success()
-
+          relationship:
+            type: {{ value }}
+""", dict(value=value)).assert_failure()
 
-# Relationship type
 
-@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
-def test_node_type_requirement_relationship_type_syntax_type(parser, value):
+def test_node_type_requirement_relationship_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -264,23 +263,24 @@ node_types:
       - my_requirement:
           capability: MyType
           relationship:
-            type: {{ value }}
-""", dict(value=value)).assert_failure()
+            type: UnknownType
+""").assert_failure()
 
 
-def test_node_type_requirement_relationship_type_unknown(parser):
+def test_node_type_requirement_relationship_type_short_form(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
   MyType: {}
+relationship_types:
+  MyType: {}
 node_types:
   MyType:
     requirements:
       - my_requirement:
           capability: MyType
-          relationship:
-            type: UnknownType
-""").assert_failure()
+          relationship: MyType
+""").assert_success()
 
 
 def test_node_type_requirement_relationship_type_override(parser):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
index ff579f9..d269a44 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
@@ -60,3 +60,15 @@ artifact_types:
   MyType:
     file_ext: []
 """).assert_success()
+
+
+# Unicode
+
+
+def test_artifact_type_unicode(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+artifact_types:
+  類型:
+    file_ext: [ 延期一, 延期二 ]
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/62bb9f32/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
index 1bdd0a7..c9bb780 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
@@ -55,17 +55,19 @@ interface_types:
 
 # Operation implementation
 
-def test_interface_type_operation_implementation_short_form(parser):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_interface_type_operation_implementation_primary_syntax_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
   MyType:
     my_operation:
-      implementation: an implementation
-""").assert_success()
+      implementation:
+        primary: {{ value }}
+""", dict(value=value)).assert_failure()
 
 
-def test_interface_type_operation_implementation_long_form(parser):
+def test_interface_type_operation_implementation_primary(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
@@ -73,22 +75,17 @@ interface_types:
     my_operation:
       implementation:
         primary: an implementation
-        dependencies:
-          - a dependency
-          - another dependency
 """).assert_success()
 
 
-@pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_interface_type_operation_implementation_syntax_type(parser, value):
+def test_interface_type_operation_implementation_primary_short_form(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
   MyType:
     my_operation:
-      implementation:
-        primary: {{ value }}
-""", dict(value=value)).assert_failure()
+      implementation: an implementation
+""").assert_success()
 
 
 @pytest.mark.parametrize('value', data.NOT_A_LIST)



Mime
View raw message