Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-1-parser-test-suite d6d1eba14 -> 3b236177d (forced update)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_relationship_interfaces.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_relationship_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_relationship_interfaces.py new file mode 100644 index 0000000..ee34a3a --- /dev/null +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_relationship_interfaces.py @@ -0,0 +1,92 @@ +# -*- 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. + +""" +These tests are in addition to those in common/test_type_interface.py. +""" + +import pytest + + +# Type + +def test_node_type_relationship_interface_type_override(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +relationship_types: + MyType: {} +interface_types: + MyType1: {} + MyType2: + derived_from: MyType1 +node_types: + MyType1: + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType + interfaces: + my_interface: + type: MyType1 + MyType2: + derived_from: MyType1 + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType + interfaces: + my_interface: + type: MyType2 +""").assert_success() + + +@pytest.mark.skip(reason='fix') +def test_node_type_relationship_interface_type_override_bad(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +relationship_types: + MyType: {} +interface_types: + MyType1: {} + MyType2: + derived_from: MyType1 +node_types: + MyType1: + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType + interfaces: + my_interface: + type: MyType2 + MyType2: + derived_from: MyType1 + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType + interfaces: + my_interface: + type: MyType1 +""").assert_failure() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py new file mode 100644 index 0000000..710bd22 --- /dev/null +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_type/test_node_type_requirements.py @@ -0,0 +1,361 @@ +# -*- 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 + + +# Requirements section + +@pytest.mark.parametrize('value', data.NOT_A_LIST) +def test_node_type_requirements_section_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirements_section_syntax_empty(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: [] +""").assert_success() + + +# Requirement + +@pytest.mark.parametrize('value', data.NOT_A_DICT) +def test_node_type_requirement_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: + - my_requirement: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirement_syntax_unsupported(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + unsupported: {} +""").assert_failure() + + +def test_node_type_requirement_syntax_empty(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: + - my_requirement: {} # "capability" is required +""").assert_failure() + + +# Capability + +@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) +def test_node_type_requirement_capability_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: + - my_requirement: + capability: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirement_capability_syntax_unsupported(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: + unsupported: {} +""").assert_failure() + + +def test_node_type_requirement_capability_short_form(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: MyType +""").assert_success() + + +# Capability type + +def test_node_type_requirement_capability_type_unknown(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +node_types: + MyType: + requirements: + - my_requirement: + capability: UnknownType +""").assert_failure() + + +def test_node_type_requirement_capability_type_override(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 are allowed to change the capability type to anything +""").assert_success() + + +# Node + +@pytest.mark.parametrize('value', data.NOT_A_STRING) +def test_node_type_requirement_node_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + node: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirement_node_unknown(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + node: UnknownType +""").assert_failure() + + +def test_node_type_requirement_node_override(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType1: + requirements: + - my_requirement: + capability: MyType + node: MyType3 + MyType2: + derived_from: MyType1 + requirements: + - my_requirement: + capability: MyType + node: MyType4 # you are allowed to change the node type to anything + MyType3: {} + MyType4: {} +""").assert_success() + + +# Relationship + +@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) +def test_node_type_requirement_relationship_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + relationship: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirement_relationship_syntax_unsupported(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + relationship: + unsupported: {} +""").assert_failure() + + +def test_node_type_requirement_relationship_short_form(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +relationship_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + relationship: MyType +""").assert_success() + + +# Relationship type + +@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) +def test_node_type_requirement_relationship_type_syntax_type(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + relationship: + type: {{ value }} +""", dict(value=value)).assert_failure() + + +def test_node_type_requirement_relationship_type_unknown(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + relationship: + type: UnknownType +""").assert_failure() + + +def test_node_type_requirement_relationship_type_override(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +relationship_types: + MyType1: {} + MyType2: {} +node_types: + MyType1: + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType1 + MyType2: + derived_from: MyType1 + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType2 # you are allowed to change the relationship type to anything +""").assert_success() + + +# Occurrences + +@pytest.mark.parametrize('value', data.OCCURRENCES) +def test_node_type_requirement_occurrences(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + occurrences: {{ value }} +""", dict(value=value)).assert_success() + + +@pytest.mark.parametrize('value', data.BAD_OCCURRENCES) +def test_node_type_requirement_occurrences_bad(parser, value): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + MyType: {} +node_types: + MyType: + requirements: + - my_requirement: + capability: MyType + occurrences: {{ value }} +""", dict(value=value)).assert_failure() + + +# Unicode + +def test_node_type_requirement_unicode(parser): + parser.parse_literal(""" +tosca_definitions_version: tosca_simple_yaml_1_0 +capability_types: + é¡å: {} +relationship_types: + é¡å: {} +node_types: + é¡å: + requirements: + - éæ±: + capability: é¡å + node: é¡å + relationship: + type: é¡å + occurrences: [ 0, UNBOUNDED ] +""").assert_success() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/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 deleted file mode 100644 index ae1e83e..0000000 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# 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/3b236177/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_artifacts.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_artifacts.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_artifacts.py deleted file mode 100644 index 0c28d5a..0000000 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_artifacts.py +++ /dev/null @@ -1,77 +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 - -from ... import data - - -# Artifacts section - -@pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_artifacts_section_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - artifacts: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_artifacts_section_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - artifacts: {} -""").assert_success() - - -# Artifact - -@pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_artifact_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - artifacts: - my_artifact: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_artifact_syntax_unsupported(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -artifact_types: - MyType: {} -node_types: - MyType: - artifacts: - my_artifact: - type: MyType - unsupported: {} -""").assert_failure() - - -def test_node_type_artifact_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - artifacts: - my_artifact: {} # "type" is required -""").assert_failure() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/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 deleted file mode 100644 index 1edc2cb..0000000 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py +++ /dev/null @@ -1,303 +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 - -from ... import data - - -# Capabilities section - -@pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_capabilities_section_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - capabilities: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_capabilities_section_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - capabilities: {} -""").assert_success() - - -# Capability - -@pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_capability_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - capabilities: - my_capability: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_capability_syntax_unsupported(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - unsupported: {} -""").assert_failure() - - -def test_node_type_capability_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - capabilities: - my_capability: {} # "type" is required -""").assert_failure() - - -# Description - -@pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_description_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - description: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_capability_description(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 -""").assert_success() - - -# Type - -@pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_type_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - capabilities: - my_capability: - type: {{ value }} -""", dict(value=value)).assert_failure() - - -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_override(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() - - -# Valid source types - -@pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_node_type_capability_valid_source_types_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - valid_source_types: {{ value }} -""", dict(value=value)).assert_failure() - - -@pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_valid_source_types_syntax_element_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - valid_source_types: [ {{ value }} ] -""", dict(value=value)).assert_failure() - - -def test_node_type_capability_valid_source_types_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - valid_source_types: [] -""").assert_success() - - - -def test_node_type_capability_valid_source_types(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType1: - capabilities: - my_capability: - type: MyType - valid_source_types: [ MyType1, MyType2 ] - MyType2: {} -""").assert_success() - - -def test_node_type_capability_valid_source_types_unknown(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - valid_source_types: [ UnknownType ] -""").assert_failure() - - -# Occurrences - -@pytest.mark.parametrize('value', data.OCCURRENCES) -def test_node_type_capability_occurrences(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - occurrences: {{ value }} -""", dict(value=value)).assert_success() - - -@pytest.mark.parametrize('value', data.BAD_OCCURRENCES) -def test_node_type_capability_occurrences_bad(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - capabilities: - my_capability: - type: MyType - occurrences: {{ value }} -""", dict(value=value)).assert_failure() - - -# Unicode - -@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES) -def test_node_type_capability_unicode(parser, parameter_section): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - é¡å: {} -node_types: - é¡å: - capabilities: - è½å: - type: é¡å - {{ parameter_section }}: - åæ¸: - type: string - description: æè¿° - default: å¼ - status: supported -""", dict(parameter_section=parameter_section)).assert_success() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py deleted file mode 100644 index ee34a3a..0000000 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py +++ /dev/null @@ -1,92 +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. - -""" -These tests are in addition to those in common/test_type_interface.py. -""" - -import pytest - - -# Type - -def test_node_type_relationship_interface_type_override(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -relationship_types: - MyType: {} -interface_types: - MyType1: {} - MyType2: - derived_from: MyType1 -node_types: - MyType1: - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType - interfaces: - my_interface: - type: MyType1 - MyType2: - derived_from: MyType1 - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType - interfaces: - my_interface: - type: MyType2 -""").assert_success() - - -@pytest.mark.skip(reason='fix') -def test_node_type_relationship_interface_type_override_bad(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -relationship_types: - MyType: {} -interface_types: - MyType1: {} - MyType2: - derived_from: MyType1 -node_types: - MyType1: - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType - interfaces: - my_interface: - type: MyType2 - MyType2: - derived_from: MyType1 - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType - interfaces: - my_interface: - type: MyType1 -""").assert_failure() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/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 deleted file mode 100644 index 710bd22..0000000 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py +++ /dev/null @@ -1,361 +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 - -from ... import data - - -# Requirements section - -@pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_node_type_requirements_section_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirements_section_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: [] -""").assert_success() - - -# Requirement - -@pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_requirement_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: - - my_requirement: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirement_syntax_unsupported(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - unsupported: {} -""").assert_failure() - - -def test_node_type_requirement_syntax_empty(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: - - my_requirement: {} # "capability" is required -""").assert_failure() - - -# Capability - -@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) -def test_node_type_requirement_capability_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: - - my_requirement: - capability: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirement_capability_syntax_unsupported(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: - unsupported: {} -""").assert_failure() - - -def test_node_type_requirement_capability_short_form(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: MyType -""").assert_success() - - -# Capability type - -def test_node_type_requirement_capability_type_unknown(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - MyType: - requirements: - - my_requirement: - capability: UnknownType -""").assert_failure() - - -def test_node_type_requirement_capability_type_override(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 are allowed to change the capability type to anything -""").assert_success() - - -# Node - -@pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_requirement_node_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - node: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirement_node_unknown(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - node: UnknownType -""").assert_failure() - - -def test_node_type_requirement_node_override(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType1: - requirements: - - my_requirement: - capability: MyType - node: MyType3 - MyType2: - derived_from: MyType1 - requirements: - - my_requirement: - capability: MyType - node: MyType4 # you are allowed to change the node type to anything - MyType3: {} - MyType4: {} -""").assert_success() - - -# Relationship - -@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) -def test_node_type_requirement_relationship_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - relationship: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirement_relationship_syntax_unsupported(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - relationship: - unsupported: {} -""").assert_failure() - - -def test_node_type_requirement_relationship_short_form(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -relationship_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - relationship: MyType -""").assert_success() - - -# Relationship type - -@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) -def test_node_type_requirement_relationship_type_syntax_type(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - relationship: - type: {{ value }} -""", dict(value=value)).assert_failure() - - -def test_node_type_requirement_relationship_type_unknown(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - relationship: - type: UnknownType -""").assert_failure() - - -def test_node_type_requirement_relationship_type_override(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -relationship_types: - MyType1: {} - MyType2: {} -node_types: - MyType1: - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType1 - MyType2: - derived_from: MyType1 - requirements: - - my_requirement: - capability: MyType - relationship: - type: MyType2 # you are allowed to change the relationship type to anything -""").assert_success() - - -# Occurrences - -@pytest.mark.parametrize('value', data.OCCURRENCES) -def test_node_type_requirement_occurrences(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - occurrences: {{ value }} -""", dict(value=value)).assert_success() - - -@pytest.mark.parametrize('value', data.BAD_OCCURRENCES) -def test_node_type_requirement_occurrences_bad(parser, value): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - MyType: {} -node_types: - MyType: - requirements: - - my_requirement: - capability: MyType - occurrences: {{ value }} -""", dict(value=value)).assert_failure() - - -# Unicode - -def test_node_type_requirement_unicode(parser): - parser.parse_literal(""" -tosca_definitions_version: tosca_simple_yaml_1_0 -capability_types: - é¡å: {} -relationship_types: - é¡å: {} -node_types: - é¡å: - requirements: - - éæ±: - capability: é¡å - node: é¡å - relationship: - type: é¡å - occurrences: [ 0, UNBOUNDED ] -""").assert_success() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/tests/mechanisms/parsing/aria.py ---------------------------------------------------------------------- diff --git a/tests/mechanisms/parsing/aria.py b/tests/mechanisms/parsing/aria.py index c9b4630..fb7024d 100644 --- a/tests/mechanisms/parsing/aria.py +++ b/tests/mechanisms/parsing/aria.py @@ -56,6 +56,7 @@ class AriaParser(Parser): context.presentation.threads = 1 # tests already run in maximum thread density context.presentation.cache = cache context.presentation.import_profile = import_profile + context.presentation.validate_normative = False context.presentation.print_exceptions = debug return context http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3b236177/tests/topology/test_configuration.py ---------------------------------------------------------------------- diff --git a/tests/topology/test_configuration.py b/tests/topology/test_configuration.py index 6552486..2a3bcae 100644 --- a/tests/topology/test_configuration.py +++ b/tests/topology/test_configuration.py @@ -15,10 +15,10 @@ import pytest -from .service_templates import consume_literal - from aria.modeling.utils import parameters_as_values +from .service_templates import consume_literal + TEMPLATE = """ tosca_definitions_version: tosca_simple_yaml_1_0