You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by em...@apache.org on 2017/08/30 22:13:20 UTC
[04/10] incubator-ariatosca git commit: More tests,
some reorganization
More tests, some reorganization
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8b7f6604
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8b7f6604
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8b7f6604
Branch: refs/heads/ARIA-1-parser-test-suite
Commit: 8b7f6604b444e2f46dcf0bf3bfe8756d4e0004c8
Parents: 8c05149
Author: Tal Liron <ta...@gmail.com>
Authored: Tue Aug 29 16:53:58 2017 -0500
Committer: Tal Liron <ta...@gmail.com>
Committed: Wed Aug 30 10:40:50 2017 -0500
----------------------------------------------------------------------
.../simple_v1_0/definitions.py | 2 +
.../simple_v1_0/test_imports.py | 2 +-
.../simple_v1_0/test_metadata.py | 4 +-
.../simple_v1_0/types/common/__init__.py | 14 +
.../types/common/test_type_interfaces.py | 413 +++++++++++++++++++
.../types/common/test_type_parameters.py | 334 +++++++++++++++
.../simple_v1_0/types/common/test_types.py | 152 +++++++
.../simple_v1_0/types/node_types/__init__.py | 14 +
.../types/node_types/test_node_type.py | 68 +++
.../node_types/test_node_type_capabilities.py | 222 ++++++++++
.../node_types/test_node_type_requirements.py | 36 ++
.../simple_v1_0/types/test_node_type.py | 68 ---
.../types/test_node_type_capabilities.py | 72 ----
.../types/test_node_type_requirements.py | 69 ----
.../simple_v1_0/types/test_type_interfaces.py | 410 ------------------
.../simple_v1_0/types/test_type_parameters.py | 334 ---------------
.../simple_v1_0/types/test_types.py | 152 -------
17 files changed, 1258 insertions(+), 1108 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/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 da08a07..c1a2a66 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/definitions.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/definitions.py
@@ -342,6 +342,8 @@ class RelationshipDefinition(ExtensiblePresentation):
The optional reserved keyname used to provide the name of the Relationship Type for the
requirement definition's relationship keyname.
+ ARIA NOTE: the spec shows this as a required field.
+
:type: :obj:`basestring`
"""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/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 4d8af8b..0177ef7 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
@@ -138,7 +138,7 @@ topology_template:
""", dict(repository=repository)).assert_success()
-# Failures
+# Bad imports
def test_import_not_found(parser):
parser.parse_literal("""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/test_metadata.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_metadata.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_metadata.py
index 3f89bf6..1a109c1 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_metadata.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_metadata.py
@@ -59,7 +59,7 @@ metadata: {}
""").assert_success()
-# Normative
+# Normative fields
@pytest.mark.parametrize('value', data.GOOD_VERSIONS)
def test_metadata_normative_template_version(parser, value):
@@ -79,7 +79,7 @@ metadata:
""", dict(value=value)).assert_failure()
-# Non-normative
+# Non-normative fields
def test_metadata_with_non_normative_fields(parser):
parser.parse_literal("""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/__init__.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/__init__.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/__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/8b7f6604/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
new file mode 100644
index 0000000..185451e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
@@ -0,0 +1,413 @@
+# -*- 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
+
+
+TYPE_NAMES = ('node', 'relationship', 'group')
+
+
+# Syntax
+
+@pytest.mark.parametrize('name,value', itertools.product(
+ TYPE_NAMES,
+ data.NOT_A_DICT
+))
+def test_type_interface_wrong_yaml_type(parser, name, value):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_empty(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface: {} # "type" is required
+""", dict(name=name)).assert_failure()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_fields(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ inputs: {}
+ operation1: {}
+ operation2: {}
+""", dict(name=name)).assert_success()
+
+
+# Type
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_type_override_good(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType1: {}
+ MyType2: {}
+{{ name }}_types:
+ MyType1:
+ interfaces:
+ my_interface:
+ type: MyType1
+ MyType2:
+ derived_from: MyType1
+ interfaces:
+ my_interface:
+ type: MyType2
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_type_override_bad(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType1: {}
+ MyType2: {}
+{{ name }}_types:
+ MyType1:
+ interfaces:
+ my_interface:
+ type: MyType2
+ MyType2:
+ derived_from: MyType1
+ interfaces:
+ my_interface:
+ type: MyType1
+""", dict(name=name)).assert_failure()
+
+
+# Interface inputs
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_inputs_add(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: string
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ inputs:
+ my_input2:
+ type: string
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_inputs_type_override_same(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: string
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ inputs:
+ my_input1:
+ type: string
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_inputs_type_override_derived(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+ MyType1: {}
+ MyType2:
+ derived_from: MyType1
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: MyType1
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ inputs:
+ my_input1:
+ type: MyType2
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.skip(reason='fix')
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_inputs_type_override_bad(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+ MyType1: {}
+ MyType2: {}
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: MyType2
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ inputs:
+ my_input1:
+ type: MyType1
+""", dict(name=name)).assert_failure()
+
+
+# Operations
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_empty(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1: {}
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_fields(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ description: a description
+ implementation: {}
+ inputs: {}
+""", dict(name=name)).assert_success()
+
+
+# Operation implementation
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_implementation_short_form(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ implementation: an implementation
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_implementation_long_form(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ implementation:
+ primary: an implementation
+ dependencies:
+ - a dependency
+ - another dependency
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+ TYPE_NAMES,
+ data.NOT_A_STRING
+))
+def test_type_interface_operation_implementation_wrong_yaml_type(parser, name, value):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ implementation:
+ primary: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name,value', itertools.product(
+ TYPE_NAMES,
+ data.NOT_A_STRING
+))
+def test_type_interface_operation_dependencies_wrong_yaml_type(parser, name, value):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType: {}
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ implementation:
+ primary: an implementation
+ dependencies:
+ - {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+# Operation inputs
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_inputs_add(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: string
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ inputs:
+ my_input2:
+ type: string
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_inputs_override_same_type(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: string
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ inputs:
+ my_input1:
+ type: string
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_inputs_override_derived_type(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+ MyType1: {}
+ MyType2:
+ derived_from: MyType1
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: MyType1
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ inputs:
+ my_input1:
+ type: MyType2
+""", dict(name=name)).assert_success()
+
+
+@pytest.mark.skip(reason='fix')
+@pytest.mark.parametrize('name', TYPE_NAMES)
+def test_type_interface_operation_inputs_override_bad(parser, name):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+data_types:
+ MyType1: {}
+ MyType2:
+ derived_from: MyType1
+interface_types:
+ MyType:
+ inputs:
+ my_input1:
+ type: MyType2
+{{ name }}_types:
+ MyType:
+ interfaces:
+ my_interface:
+ type: MyType
+ operation1:
+ inputs:
+ my_input1:
+ type: MyType1
+""", dict(name=name)).assert_failure()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
new file mode 100644
index 0000000..291abc8
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
@@ -0,0 +1,334 @@
+# -*- 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'),
+ ('interface', 'inputs'),
+ ('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_parameter:
+ type: string
+ description: a description
+ default: a value
+ status: supported
+""", dict(name=name, parameter_section=parameter_section)).assert_success()
+
+
+@pytest.mark.parametrize('name,parameter_section', SECTIONS)
+def test_node_type_parameter_fields_unicode(parser, name, parameter_section):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+ MyType:
+ {{ parameter_section }}:
+ 參數:
+ type: string
+ description: 描述
+ default: 值
+ 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_parameter:
+ 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_parameter:
+ type: string
+ status: not a status
+""", 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_parameter:
+ type: map
+ entry_schema: {{ values[0] }}
+topology_template:
+ node_templates:
+ my_template:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ 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_parameter:
+ type: map
+ entry_schema: {{ values[0] }}
+topology_template:
+ node_templates:
+ my_template:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ 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_parameter:
+ type: list
+ entry_schema: {{ values[0] }}
+topology_template:
+ node_templates:
+ my_template:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ - {{ 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_parameter:
+ type: list
+ entry_schema: {{ values[0] }}
+topology_template:
+ node_templates:
+ my_template:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ - {{ 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_add_default(parser, section):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+ MyType1:
+ {{ section }}:
+ my_parameter:
+ type: string
+ MyType2:
+ derived_from: MyType1
+ {{ section }}:
+ my_parameter:
+ type: string
+ default: my value
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_parameter_type_override(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_parameter:
+ type: MyType1
+ MyType2:
+ derived_from: MyType1
+ {{ section }}:
+ my_parameter:
+ type: MyType2
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_parameter_type_override_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_parameter:
+ type: MyType2
+ MyType2:
+ derived_from: MyType1
+ {{ section }}:
+ my_parameter:
+ type: MyType1
+""", dict(section=section)).assert_failure()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
new file mode 100644
index 0000000..53845c5
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/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()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/__init__.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/__init__.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_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/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type.py
new file mode 100644
index 0000000..4b1c446
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_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
+
+# All fields except "requirements", which is a sequenced list
+DICT_FIELD_NAMES = ('properties', 'attributes', 'capabilities', 'interfaces', 'artifacts')
+
+
+# Fields
+
+@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/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
new file mode 100644
index 0000000..0b1abf6
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
@@ -0,0 +1,222 @@
+# -*- 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
+
+
+SECTION_NAMES = ('properties', 'attributes')
+
+
+# Syntax
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_node_type_capability_wrong_yaml_type(parser, value):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType: {}
+node_types:
+ MyType:
+ capabilities:
+ my_capability: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_capability_empty(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType: {}
+node_types:
+ MyType:
+ capabilities:
+ my_capability: {} # "type" is required
+""").assert_failure()
+
+
+def test_node_type_capability_fields(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType: {}
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: MyType
+ description: a description
+ properties: {}
+ attributes: {}
+ valid_source_types: []
+ occurrences: [ 0, UNBOUNDED ]
+""").assert_success()
+
+
+# Type
+
+def test_node_type_capability_type_unknown(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: UnknownType
+""").assert_failure()
+
+
+def test_node_type_capability_type_null(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: null
+""").assert_failure()
+
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+def test_node_type_capability_type_override_good(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType1: {}
+ MyType2:
+ derived_from: MyType1
+node_types:
+ MyType1:
+ capabilities:
+ my_capability:
+ type: MyType1
+ MyType2:
+ derived_from: MyType1
+ capabilities:
+ my_capability:
+ type: MyType2
+""").assert_success()
+
+
+def test_node_type_capability_type_override_bad(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType1: {}
+ MyType2:
+ derived_from: MyType1
+node_types:
+ MyType1:
+ capabilities:
+ my_capability:
+ type: MyType2
+ MyType2:
+ derived_from: MyType1
+ capabilities:
+ my_capability:
+ type: MyType1
+""").assert_failure()
+
+
+# Parameters
+
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_capability_parameter_add(parser, section):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType:
+ {{ section }}:
+ my_parameter1:
+ type: string
+ description: a description
+ default: a value
+ status: supported
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: MyType
+ {{ section }}:
+ my_parameter2:
+ type: string
+ description: a description
+ default: a value
+ status: supported
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.skip(reason='fixed in ARIA-351')
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_capability_parameter_override(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
+capability_types:
+ MyType:
+ {{ section }}:
+ my_parameter:
+ type: MyType1
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ type: MyType2
+""", dict(section=section)).assert_success()
+
+
+@pytest.mark.skip(reason='fix')
+@pytest.mark.parametrize('section', SECTION_NAMES)
+def test_node_type_capability_parameter_override_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
+capability_types:
+ MyType:
+ {{ section }}:
+ my_parameter:
+ type: MyType2
+node_types:
+ MyType:
+ capabilities:
+ my_capability:
+ type: MyType
+ {{ section }}:
+ my_parameter:
+ type: MyType1
+""", dict(section=section)).assert_failure()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
new file mode 100644
index 0000000..5ad866f
--- /dev/null
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
@@ -0,0 +1,36 @@
+# -*- 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_good(parser):
+ parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+ MyType1: {}
+ MyType2: {}
+node_types:
+ MyType1:
+ requirements:
+ - my_requirement:
+ capability: MyType1
+ MyType2:
+ derived_from: MyType1
+ requirements:
+ - my_requirement:
+ capability: MyType2 # you should be allowed to change the capability type to anything
+""").assert_success()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/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
deleted file mode 100644
index b2767c1..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type.py
+++ /dev/null
@@ -1,68 +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
-
-
-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/8b7f6604/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
deleted file mode 100644
index fa9af73..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_capabilities.py
+++ /dev/null
@@ -1,72 +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 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/8b7f6604/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
deleted file mode 100644
index b823cd4..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_node_type_requirements.py
+++ /dev/null
@@ -1,69 +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.
-
-
-# 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/8b7f6604/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_interfaces.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_interfaces.py
deleted file mode 100644
index 4b47a0b..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_interfaces.py
+++ /dev/null
@@ -1,410 +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
-
-
-TYPE_NAMES = ('node', 'relationship', 'group')
-
-
-# Syntax
-
-@pytest.mark.parametrize('name,value', itertools.product(
- TYPE_NAMES,
- data.NOT_A_DICT
-))
-def test_type_interface_wrong_yaml_type(parser, name, value):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface: {{ value }}
-""", dict(name=name, value=value)).assert_failure()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_empty(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface: {} # "type" is required
-""", dict(name=name)).assert_failure()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_fields(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- inputs: {}
- operation1: {}
- operation2: {}
-""", dict(name=name)).assert_success()
-
-
-# Type
-
-@pytest.mark.skip(reason='fixed in ARIA-351')
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_override_type_good(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType1: {}
- MyType2: {}
-{{ name }}_types:
- MyType1:
- interfaces:
- my_interface:
- type: MyType1
- MyType2:
- derived_from: MyType1
- interfaces:
- my_interface:
- type: MyType2
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_override_type_bad(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType1: {}
- MyType2: {}
-{{ name }}_types:
- MyType1:
- interfaces:
- my_interface:
- type: MyType2
- MyType2:
- derived_from: MyType1
- interfaces:
- my_interface:
- type: MyType1
-""", dict(name=name)).assert_failure()
-
-
-# Interface inputs
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_add(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: string
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- inputs:
- my_input2:
- type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_override_same_type(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: string
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- inputs:
- my_input1:
- type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_override_derived_type(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
- MyType1: {}
- MyType2: {}
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: MyType1
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- inputs:
- my_input1:
- type: MyType2
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_override_bad(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
- MyType1: {}
- MyType2: {}
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: MyType2
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- inputs:
- my_input1:
- type: MyType1
-""", dict(name=name)).assert_failure()
-
-
-# Operations
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_empty(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1: {}
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_fields(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- description: a description
- implementation: {}
- inputs: {}
-""", dict(name=name)).assert_success()
-
-
-# Operation implementation
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_implementation_short_form(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- implementation: an implementation
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_implementation_long_form(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- implementation:
- primary: an implementation
- dependencies:
- - a dependency
- - another dependency
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
- TYPE_NAMES,
- data.NOT_A_STRING
-))
-def test_type_interface_operation_implementation_wrong_yaml_type(parser, name, value):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- implementation:
- primary: {{ value }}
-""", dict(name=name, value=value)).assert_failure()
-
-
-@pytest.mark.parametrize('name,value', itertools.product(
- TYPE_NAMES,
- data.NOT_A_STRING
-))
-def test_type_interface_operation_dependencies_wrong_yaml_type(parser, name, value):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType: {}
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- implementation:
- primary: an implementation
- dependencies:
- - {{ value }}
-""", dict(name=name, value=value)).assert_failure()
-
-
-# Operation inputs
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_add(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: string
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- inputs:
- my_input2:
- type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_same_type(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: string
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- inputs:
- my_input1:
- type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_derived_type(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
- MyType1: {}
- MyType2: {}
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: MyType1
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- inputs:
- my_input1:
- type: MyType2
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_bad(parser, name):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
- MyType1: {}
- MyType2: {}
-interface_types:
- MyType:
- inputs:
- my_input1:
- type: MyType2
-{{ name }}_types:
- MyType:
- interfaces:
- my_interface:
- type: MyType
- operation1:
- inputs:
- my_input1:
- type: MyType1
-""", dict(name=name)).assert_failure()
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b7f6604/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
deleted file mode 100644
index 5f285ea..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_type_parameters.py
+++ /dev/null
@@ -1,334 +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
-
-
-SECTIONS = (
- ('artifact', 'properties'),
- ('data', 'properties'),
- ('capability', 'properties'),
- ('capability', 'attributes'),
- ('interface', 'inputs'),
- ('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()
-
-
-@pytest.mark.parametrize('name,parameter_section', SECTIONS)
-def test_node_type_parameter_fields_unicode(parser, name, parameter_section):
- parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
- MyType:
- {{ parameter_section }}:
- 參數:
- type: string
- description: 描述
- default: 值
- 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: not a status
-""", 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/8b7f6604/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
deleted file mode 100644
index 8e2f26f..0000000
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_types.py
+++ /dev/null
@@ -1,152 +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()