More tests.

* Make 'type' required in interface type


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

Branch: refs/heads/ARIA-1-parser-test-suite
Commit: 7556f0aa0cd5bc215f076f01f2af846c843c57c5
Parents: 9b2d9c2
Author: Tal Liron <tal.li...@gmail.com>
Authored: Fri Aug 25 17:10:15 2017 -0500
Committer: Tal Liron <tal.li...@gmail.com>
Committed: Mon Sep 11 13:56:49 2017 -0500

----------------------------------------------------------------------
 .../simple_v1_0/definitions.py                  |   2 +-
 .../simple_v1_0/modeling/parameters.py          |   8 +-
 .../simple_v1_0/conftest.py                     |   2 +
 .../aria_extension_tosca/simple_v1_0/data.py    |   1 +
 .../simple_v1_0/templates/__init__.py           |  14 +
 .../simple_v1_0/templates/test_templates.py     | 129 ++++++++
 .../simple_v1_0/test_imports.py                 |  10 +-
 .../simple_v1_0/test_templates.py               | 129 --------
 .../simple_v1_0/test_types.py                   | 153 ---------
 .../simple_v1_0/types/__init__.py               |  14 +
 .../simple_v1_0/types/test_node_type.py         |  68 ++++
 .../types/test_node_type_capabilities.py        |  72 +++++
 .../types/test_node_type_interfaces.py          |  72 +++++
 .../types/test_node_type_requirements.py        |  69 ++++
 .../simple_v1_0/types/test_type_parameters.py   | 318 +++++++++++++++++++
 .../simple_v1_0/types/test_types.py             | 152 +++++++++
 16 files changed, 924 insertions(+), 289 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/extensions/aria_extension_tosca/simple_v1_0/definitions.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/definitions.py 
b/extensions/aria_extension_tosca/simple_v1_0/definitions.py
index 9158776..da08a07 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/definitions.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/definitions.py
@@ -283,7 +283,7 @@ class InterfaceDefinition(ExtensiblePresentation):
 
     @field_validator(type_validator('interface type', 
convert_name_to_full_type_name,
                                     'interface_types'))
-    @primitive_field(str)
+    @primitive_field(str, required=True)
     def type(self):
         """
         ARIA NOTE: This field is not mentioned in the spec, but is implied.

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py
index 9bafeec..180ba28 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/parameters.py
@@ -148,10 +148,10 @@ def validate_required_values(context, presentation, 
values, definitions):
     if not definitions:
         return
     for name, definition in definitions.iteritems():
-        if getattr(definition, 'required', False) and \
-            ((values is None) or (values.get(name) is None)):
-            context.validation.report('required property "%s" is not assigned 
a value in "%s"'
-                                      % (name, presentation._fullname),
+        if getattr(definition, 'required', False) \
+            and ((values is None) or (values.get(name) is None)):
+            context.validation.report('required property "{0}" is not assigned 
a value in "{1}"'
+                                      .format(name, presentation._fullname),
                                       
locator=presentation._get_child_locator('properties'),
                                       level=Issue.BETWEEN_TYPES)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/conftest.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/conftest.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/conftest.py
index 399e8c8..bd89b19 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/conftest.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/conftest.py
@@ -15,6 +15,8 @@
 
 """
 PyTest configuration module.
+
+Add support for a "--tosca-parser" CLI option.
 """
 
 import pytest

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/data.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/data.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/data.py
index b24fb29..1edb5e3 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/data.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/data.py
@@ -38,3 +38,4 @@ TEMPLATE_NAME_SECTION = {
 }
 GOOD_VERSIONS = ("'6.1'", '2.0.1', '3.1.0.beta', "'1.0.0.alpha-10'")
 BAD_VERSIONS = ('a_string', '1.2.3.4.5', '1.2.beta', '1.0.0.alpha-x')
+STATUSES = ('supported', 'unsupported', 'experimental', 'deprecated')

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/templates/__init__.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/__init__.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/__init__.py
@@ -0,0 +1,14 @@
+# 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.

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_templates.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_templates.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_templates.py
new file mode 100644
index 0000000..98f06ca
--- /dev/null
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_templates.py
@@ -0,0 +1,129 @@
+# -*- 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 itertools
+
+import pytest
+
+from .. import data
+
+
+# Syntax
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_topology_template_wrong_yaml_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_topology_template_emtpy(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template: {}
+""").assert_success()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TEMPLATE_NAMES,
+    data.NOT_A_DICT
+))
+def test_template_section_wrong_yaml_type(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template:
+  {{ section }}: {{ value }}
+""", dict(section=data.TEMPLATE_NAME_SECTION[name], 
value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TEMPLATE_NAMES,
+    data.NOT_A_STRING
+))
+def test_template_type_wrong_yaml_type(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template:
+  {{ section }}:
+    my_template:
+      type: {{ value }}
+""", dict(section=data.TEMPLATE_NAME_SECTION[name], 
value=value)).assert_failure()
+
+
+# Common fields
+
+@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
+def test_template_fields(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template:
+  {{ section }}:
+    my_template:
+      type: tosca.{{ plural }}.Root
+      description: a description
+""", dict(section=data.TEMPLATE_NAME_SECTION[name],
+          plural=data.TYPE_NAME_PLURAL[name])).assert_success()
+
+
+# Of types
+
+@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
+def test_template_of_type(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+    MyType: {}
+topology_template:
+  {{ section }}:
+    my_template:
+      type: MyType
+""", dict(name=name, 
section=data.TEMPLATE_NAME_SECTION[name])).assert_success()
+
+
+@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
+def test_template_of_type_unicode(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+    類型: {}
+topology_template:
+  {{ section }}:
+    模板:
+      type: 類型
+""", dict(name=name, 
section=data.TEMPLATE_NAME_SECTION[name])).assert_success()
+
+
+@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
+def test_template_of_unknown_type(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template:
+  {{ section }}:
+    my_template:
+      type: UnknownType
+""", dict(section=data.TEMPLATE_NAME_SECTION[name])).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
+def test_template_of_null_type(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+topology_template:
+  {{ section }}:
+    my_template:
+      type: null
+""", dict(section=data.TEMPLATE_NAME_SECTION[name])).assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/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 765cd8b..4d8af8b 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
@@ -28,6 +28,12 @@ node_types:
     derived_from: tosca.nodes.Root
 """
 
+NODE_TYPE_IMPORT_UNICODE = """
+node_types:
+  類型:
+    derived_from: tosca.nodes.Root
+"""
+
 BAD_IMPORT = """
 node_types:
   MyNode:
@@ -39,7 +45,7 @@ def repository():
     repository = WebServer()
     repository.add_text_yaml('/imports/node-type.yaml', NODE_TYPE_IMPORT)
     
repository.add_text_yaml('/imports/{0}.yaml'.format(WebServer.escape('節點類型')),
-                             NODE_TYPE_IMPORT)
+                             NODE_TYPE_IMPORT_UNICODE)
     repository.add_text_yaml('/imports/bad.yaml', BAD_IMPORT)
     with repository:
         yield repository.root
@@ -84,7 +90,7 @@ imports:
 topology_template:
   node_templates:
     my_node:
-      type: MyNode
+      type: 類型
 """, dict(repository=repository)).assert_success()
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/test_templates.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/test_templates.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/test_templates.py
deleted file mode 100644
index 8b0fd0e..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_templates.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- 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 itertools
-
-import pytest
-
-from . import data
-
-
-# Syntax
-
-@pytest.mark.parametrize('value', data.NOT_A_DICT)
-def test_topology_template_wrong_yaml_type(parser, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template: {{ value }}
-""", dict(value=value)).assert_failure()
-
-
-def test_topology_template_emtpy(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template: {}
-""").assert_success()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
-    data.TEMPLATE_NAMES,
-    data.NOT_A_DICT
-))
-def test_template_section_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template:
-  {{ section }}: {{ value }}
-""", dict(section=data.TEMPLATE_NAME_SECTION[name], 
value=value)).assert_failure()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
-    data.TEMPLATE_NAMES,
-    data.NOT_A_STRING
-))
-def test_template_type_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template:
-  {{ section }}:
-    my_template:
-      type: {{ value }}
-""", dict(section=data.TEMPLATE_NAME_SECTION[name], 
value=value)).assert_failure()
-
-
-# Common fields
-
-@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
-def test_template_fields(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template:
-  {{ section }}:
-    my_template:
-      type: tosca.{{ plural }}.Root
-      description: a description
-""", dict(section=data.TEMPLATE_NAME_SECTION[name],
-          plural=data.TYPE_NAME_PLURAL[name])).assert_success()
-
-
-# Of types
-
-@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
-def test_template_of_type(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-    MyType: {}
-topology_template:
-  {{ section }}:
-    my_template:
-      type: MyType
-""", dict(name=name, 
section=data.TEMPLATE_NAME_SECTION[name])).assert_success()
-
-
-@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
-def test_template_of_type_unicode(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-    類型: {}
-topology_template:
-  {{ section }}:
-    模板:
-      type: 類型
-""", dict(name=name, 
section=data.TEMPLATE_NAME_SECTION[name])).assert_success()
-
-
-@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
-def test_template_of_unknown_type(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template:
-  {{ section }}:
-    my_template:
-      type: UnknownType
-""", dict(section=data.TEMPLATE_NAME_SECTION[name])).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TEMPLATE_NAMES)
-def test_template_of_null_type(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-topology_template:
-  {{ section }}:
-    my_template:
-      type: null
-""", dict(section=data.TEMPLATE_NAME_SECTION[name])).assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/test_types.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_types.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/test_types.py
deleted file mode 100644
index 0699e1e..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_types.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- 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 itertools
-
-import pytest
-
-from . import data
-
-
-# Syntax
-
-@pytest.mark.parametrize('name,value', itertools.product(
-    data.TYPE_NAMES,
-    data.NOT_A_DICT
-))
-def test_type_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType: {{ value }}
-""", dict(name=name, value=value)).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_empty(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType: {}
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
-    data.TYPE_NAMES,
-    data.NOT_A_STRING
-))
-def test_type_derived_from_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: {{ value }}
-""", dict(name=name, value=value)).assert_failure()
-
-
-
-# Derivation
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_unknown(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: UnknownType
-""", dict(name=name)).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_null(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: null
-""", dict(name=name)).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_self(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: MyType
-""", dict(name=name)).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_circular(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType1:
-    derived_from: MyType3
-  MyType2:
-    derived_from: MyType1
-  MyType3:
-    derived_from: MyType2
-""", dict(name=name)).assert_failure()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_root(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: tosca.{{ plural }}.Root
-""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
-
-
-# Common fields
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_fields(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    derived_from: tosca.{{ plural }}.Root
-    version: 1.0.0
-    description: a description
-""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
-
-
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_fields_unicode(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  類型:
-    derived_from: tosca.{{ plural }}.Root
-    version: 1.0.0.詠嘆調-10
-    description: 描述
-""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
-    data.TYPE_NAMES,
-    data.BAD_VERSIONS
-))
-def test_type_bad_version(parser, name, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType:
-    version: {{ value }}
-""", dict(name=name, value=value)).assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/__init__.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/__init__.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/__init__.py
@@ -0,0 +1,14 @@
+# 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.

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type.py
new file mode 100644
index 0000000..b2767c1
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type.py
@@ -0,0 +1,68 @@
+# -*- 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 itertools
+
+import pytest
+
+from .. import data
+
+
+DICT_FIELD_NAMES = ('properties', 'attributes', 'capabilities', 'interfaces', 
'artifacts')
+
+
+# Syntax
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    DICT_FIELD_NAMES,
+    data.NOT_A_DICT
+))
+def test_node_type_fields_wrong_yaml_type(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ name }}: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('value', data.NOT_A_LIST)
+def test_node_type_requirements_wrong_yaml_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    requirements: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name', DICT_FIELD_NAMES)
+def test_node_type_fields_empty(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ name }}: {}
+""", dict(name=name)).assert_success()
+
+
+def test_node_type_requirements_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    requirements: []
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_capabilities.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_capabilities.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_capabilities.py
new file mode 100644
index 0000000..fa9af73
--- /dev/null
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_capabilities.py
@@ -0,0 +1,72 @@
+# -*- 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
+
+
+# Overriding
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+def test_node_type_capability_override_change_type_good(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType1:
+    properties:
+      prop1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      prop2:
+        type: integer
+node_types:
+  MyType1:
+    capabilities:
+      my_capability:
+        type: MyType1
+  MyType2:
+    derived_from: MyType1
+    capabilities:
+      my_capability:
+        type: MyType2
+""").assert_success()
+
+
+def test_node_type_capability_override_change_type_bad(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType1:
+    properties:
+      prop1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      prop2:
+        type: integer
+node_types:
+  MyType1:
+    capabilities:
+      my_capability:
+        type: MyType2
+  MyType2:
+    derived_from: MyType1
+    capabilities:
+      my_capability:
+        type: MyType1
+""").assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_interfaces.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_interfaces.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_interfaces.py
new file mode 100644
index 0000000..0228c02
--- /dev/null
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_interfaces.py
@@ -0,0 +1,72 @@
+# -*- 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
+
+
+# Overriding
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+def test_node_type_interface_override_change_type_good(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+  MyType1:
+    inputs:
+      input1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    inputs:
+      input2:
+        type: integer
+node_types:
+  MyType1:
+    interfaces:
+      my_interface:
+        type: MyType1
+  MyType2:
+    derived_from: MyType1
+    interfaces:
+      my_interface:
+        type: MyType2
+""").assert_success()
+
+
+def test_node_type_interface_override_change_type_bad(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+  MyType1:
+    inputs:
+      input1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    inputs:
+      input2:
+        type: integer
+node_types:
+  MyType1:
+    interfaces:
+      my_interface:
+        type: MyType2
+  MyType2:
+    derived_from: MyType1
+    interfaces:
+      my_interface:
+        type: MyType1
+""").assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_requirements.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_requirements.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_requirements.py
new file mode 100644
index 0000000..b823cd4
--- /dev/null
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_requirements.py
@@ -0,0 +1,69 @@
+# -*- 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.
+
+
+# Overriding
+
+def test_node_type_requirement_override_change_type_good1(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType1:
+    properties:
+      prop1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      prop2:
+        type: integer
+node_types:
+  MyType1:
+    requirements:
+      - my_requirement:
+          capability: MyType1
+  MyType2:
+    derived_from: MyType1
+    requirements:
+      - my_requirement:
+          capability: MyType2
+""").assert_success()
+
+
+def test_node_type_requirement_override_change_type_good2(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType1:
+    properties:
+      prop1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      prop2:
+        type: integer
+node_types:
+  MyType1:
+    requirements:
+      - my_requirement:
+          capability: MyType2
+  MyType2:
+    derived_from: MyType1
+    requirements:
+      - my_requirement:
+          capability: MyType1 # you should be allowed to change the capability 
type to anything
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_parameters.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_parameters.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_parameters.py
new file mode 100644
index 0000000..be5ad43
--- /dev/null
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_parameters.py
@@ -0,0 +1,318 @@
+# -*- 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 itertools
+
+import pytest
+
+from .. import data
+
+
+SECTIONS = (
+    ('artifact', 'properties'),
+    ('data', 'properties'),
+    ('capability', 'properties'),
+    ('capability', 'attributes'),
+    ('relationship', 'properties'),
+    ('relationship', 'attributes'),
+    ('node', 'properties'),
+    ('node', 'attributes'),
+    ('group', 'properties'),
+    ('policy', 'properties')
+)
+SECTION_NAMES = ('properties', 'attributes')
+ENTRY_SCHEMA_VALUES = (
+    ('string', 'a string', 'another string'),
+    ('integer', '1', '2'),
+    ('float', '1.1', '2.2')
+)
+ENTRY_SCHEMA_VALUES_BAD = (
+    ('string', 'a string', '1'),
+    ('integer', '1', 'a string'),
+    ('float', '1.1', 'a string')
+)
+
+
+# Fields
+
+@pytest.mark.parametrize('name,parameter_section', SECTIONS)
+def test_node_type_parameter_fields(parser, name, parameter_section):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    {{ parameter_section }}:
+      my_param:
+        type: string
+        description: a description
+        default: a value
+        status: supported
+""", dict(name=name, parameter_section=parameter_section)).assert_success()
+
+
+# Status
+
+@pytest.mark.parametrize(
+    'name,parameter_section,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(SECTIONS, data.STATUSES))
+)
+def test_node_type_parameter_status_good(parser, name, parameter_section, 
value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    {{ parameter_section }}:
+      my_param:
+        type: string
+        status: {{ value }}
+""", dict(name=name, parameter_section=parameter_section, 
value=value)).assert_success()
+
+
+@pytest.mark.parametrize('name,parameter_section', SECTIONS)
+def test_node_type_parameter_status_bad(parser, name, parameter_section):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    {{ parameter_section }}:
+      my_param:
+        type: string
+        status: bad
+""", dict(name=name, parameter_section=parameter_section)).assert_failure()
+
+
+# Entry schema
+
+@pytest.mark.parametrize('section,values', itertools.product(
+    SECTION_NAMES,
+    ENTRY_SCHEMA_VALUES
+))
+def test_node_type_parameter_map(parser, section, values):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ section }}:
+      my_param:
+        type: map
+        entry_schema: {{ values[0] }}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      {{ section }}:
+        my_param:
+          key1: {{ values[1] }}
+          key2: {{ values[2] }}
+""", dict(section=section, values=values)).assert_success()
+
+
+@pytest.mark.parametrize('section,values', itertools.product(
+    SECTION_NAMES,
+    ENTRY_SCHEMA_VALUES_BAD
+))
+def test_node_type_parameter_map_bad(parser, section, values):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ section }}:
+      my_param:
+        type: map
+        entry_schema: {{ values[0] }}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      {{ section }}:
+        my_param:
+          key1: {{ values[1] }}
+          key2: {{ values[2] }}
+""", dict(section=section, values=values)).assert_failure()
+
+
+@pytest.mark.parametrize('section,values', itertools.product(
+    SECTION_NAMES,
+    ENTRY_SCHEMA_VALUES
+))
+def test_node_type_parameter_list(parser, section, values):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ section }}:
+      my_param:
+        type: list
+        entry_schema: {{ values[0] }}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      {{ section }}:
+        my_param:
+          - {{ values[1] }}
+          - {{ values[2] }}
+""", dict(section=section, values=values)).assert_success()
+
+
+@pytest.mark.parametrize('section,values', itertools.product(
+    SECTION_NAMES,
+    ENTRY_SCHEMA_VALUES_BAD
+))
+def test_node_type_parameter_list_bad(parser, section, values):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    {{ section }}:
+      my_param:
+        type: list
+        entry_schema: {{ values[0] }}
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+      {{ section }}:
+        my_param:
+          - {{ values[1] }}
+          - {{ values[2] }}
+""", dict(section=section, values=values)).assert_failure()
+
+
+# Required
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+def test_node_type_property_required(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    properties:
+      my_property:
+        type: string
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+""").assert_failure()
+
+
+def test_node_type_property_not_required(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    properties:
+      my_property:
+        type: string
+        required: false
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+""").assert_success()
+
+
+def test_node_type_property_required_with_default(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    properties:
+      my_property:
+        type: string
+        default: a string
+topology_template:
+  node_templates:
+    my_template:
+      type: MyType
+""").assert_success()
+
+
+# Overriding
+
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_parameter_override_add_default(parser, section):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType1:
+    {{ section }}:
+      my_param:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    {{ section }}:
+      my_param:
+        type: string
+        default: my value 
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+@pytest.mark.parametrize('section', ('properties', 'attributes'))
+def test_node_type_parameter_override_change_type_good(parser, section):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+  MyType1:
+    properties:
+      field1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      field2:
+        type: integer
+node_types:
+  MyType1:
+    {{ section }}:
+      my_param:
+        type: MyType1
+  MyType2:
+    derived_from: MyType1
+    {{ section }}:
+      my_param:
+        type: MyType2
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.parametrize('section', ('properties', 'attributes'))
+def test_node_type_parameter_override_change_type_bad(parser, section):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+  MyType1:
+    properties:
+      field1:
+        type: string
+  MyType2:
+    derived_from: MyType1
+    properties:
+      field2:
+        type: integer
+node_types:
+  MyType1:
+    {{ section }}:
+      my_param:
+        type: MyType2
+  MyType2:
+    derived_from: MyType1
+    {{ section }}:
+      my_param:
+        type: MyType1
+""", dict(section=section)).assert_failure()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7556f0aa/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_types.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_types.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_types.py
new file mode 100644
index 0000000..8e2f26f
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_types.py
@@ -0,0 +1,152 @@
+# -*- 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 itertools
+
+import pytest
+
+from .. import data
+
+
+# Syntax
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TYPE_NAMES,
+    data.NOT_A_DICT
+))
+def test_type_wrong_yaml_type(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_empty(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType: {}
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TYPE_NAMES,
+    data.NOT_A_STRING
+))
+def test_type_derived_from_wrong_yaml_type(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+# Derivation
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from_unknown(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: UnknownType
+""", dict(name=name)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from_null(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: null
+""", dict(name=name)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from_self(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: MyType
+""", dict(name=name)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from_circular(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType1:
+    derived_from: MyType3
+  MyType2:
+    derived_from: MyType1
+  MyType3:
+    derived_from: MyType2
+""", dict(name=name)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from_root(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: tosca.{{ plural }}.Root
+""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
+
+
+# Common fields
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_fields(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    derived_from: tosca.{{ plural }}.Root
+    version: 1.0.0
+    description: a description
+""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_fields_unicode(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  類型:
+    derived_from: tosca.{{ plural }}.Root
+    version: 1.0.0.詠嘆調-10
+    description: 描述
+""", dict(name=name, plural=data.TYPE_NAME_PLURAL[name])).assert_success()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TYPE_NAMES,
+    data.BAD_VERSIONS
+))
+def test_type_bad_version(parser, name, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    version: {{ value }}
+""", dict(name=name, value=value)).assert_failure()


Reply via email to