More consolidations, template interface tests * Fixes for node template relationship interfaces
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/354328e9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/354328e9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/354328e9 Branch: refs/heads/ARIA-1-parser-test-suite Commit: 354328e943c00e834253dbf255e7f83410efdbd1 Parents: 1d8ac54 Author: Tal Liron <[email protected]> Authored: Wed Sep 20 17:21:31 2017 -0500 Committer: Tal Liron <[email protected]> Committed: Wed Sep 20 17:21:31 2017 -0500 ---------------------------------------------------------------------- .../simple_v1_0/assignments.py | 22 + .../simple_v1_0/modeling/interfaces.py | 5 + .../aria_extension_tosca/simple_v1_0/data.py | 3 +- .../templates/common/test_template_interface.py | 745 ++++++++++++------- .../common/test_template_parameters.py | 87 +-- .../templates/common/test_templates.py | 13 +- .../simple_v1_0/templates/test_group.py | 6 +- .../templates/test_policy_template.py | 6 +- .../templates/test_topology_template.py | 15 +- .../simple_v1_0/test_imports.py | 7 +- .../simple_v1_0/test_metadata.py | 14 +- .../simple_v1_0/test_service_template.py | 2 +- .../types/common/test_type_interfaces.py | 152 ++-- .../types/common/test_type_parameters.py | 166 ++--- .../simple_v1_0/types/common/test_types.py | 23 +- .../types/node_types/test_node_type.py | 12 +- .../node_types/test_node_type_capabilities.py | 16 +- .../node_types/test_node_type_requirements.py | 16 +- .../simple_v1_0/types/test_artifact_type.py | 8 +- .../simple_v1_0/types/test_capability_type.py | 6 +- .../simple_v1_0/types/test_data_type.py | 13 +- .../simple_v1_0/types/test_group_type.py | 6 +- .../simple_v1_0/types/test_interface_type.py | 21 +- .../simple_v1_0/types/test_policy_type.py | 6 +- .../simple_v1_0/types/test_relationship_type.py | 6 +- tests/mechanisms/utils.py | 71 ++ 26 files changed, 890 insertions(+), 557 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/extensions/aria_extension_tosca/simple_v1_0/assignments.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/assignments.py b/extensions/aria_extension_tosca/simple_v1_0/assignments.py index 7b48ed0..0e066ff 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py +++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py @@ -144,6 +144,17 @@ class InterfaceAssignment(ExtensiblePresentation): # In RelationshipAssignment the_type = the_type[0] # This could be a RelationshipTemplate + if isinstance(self._container._container, RequirementAssignment): + # In RequirementAssignment + requirement_definition = self._container._container._get_definition(context) + if requirement_definition is not None: + relationship_definition = requirement_definition.relationship + if relationship_definition is not None: + interface_definitions = relationship_definition.interfaces + if interface_definitions is not None: + if self._name in interface_definitions: + return interface_definitions[self._name]._get_type(context) + interface_definitions = the_type._get_interfaces(context) \ if the_type is not None else None interface_definition = interface_definitions.get(self._name) \ @@ -172,6 +183,8 @@ class RelationshipAssignment(ExtensiblePresentation): The optional reserved keyname used to provide the name of the Relationship Type for the requirement assignment's relationship keyname. + ARIA NOTE: this can also be a relationship template name. + :type: :obj:`basestring` """ @@ -290,6 +303,15 @@ class RequirementAssignment(ExtensiblePresentation): return None, None @cachedmethod + def _get_definition(self, context): + node_type = self._container._get_type(context) + if (node_type is not None) and (node_type.requirements is not None): + for name, requirement in node_type.requirements: + if name == self._name: + return requirement + return None + + @cachedmethod def _get_capability(self, context): capability = self.capability http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py index 26fb546..06445f8 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/interfaces.py @@ -276,6 +276,10 @@ def merge_interface(context, presentation, interface_assignment, our_interface_a .format(interface_name, operation_name, presentation._fullname), locator=our_operation_template._locator, level=Issue.BETWEEN_TYPES) + # Failsafe to avoid exceptions for invalid assignments + if operation_name not in interface_assignment._raw: + continue + if (our_input_assignments is not None) or (our_implementation is not None): # Make sure we have the dict if (operation_name not in interface_assignment._raw) \ @@ -286,6 +290,7 @@ def merge_interface(context, presentation, interface_assignment, our_interface_a interface_assignment._raw[operation_name]['implementation'] = \ deepcopy_with_locators(our_implementation._raw) + # Assign/merge operation inputs input_definitions = operation_definition.inputs \ if operation_definition is not None else None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/data.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/data.py b/tests/extensions/aria_extension_tosca/simple_v1_0/data.py index 7693132..2ddda66 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/data.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/data.py @@ -33,7 +33,6 @@ TYPE_NAME_PLURAL = { PRIMITIVE_TYPE_NAMES = ('string', 'integer', 'float', 'boolean') PARAMETER_SECTION_NAMES = ('properties', 'attributes') TEMPLATE_NAMES = ('node', 'group', 'relationship', 'policy') -TEMPLATE_WITH_INTERFACE_NAMES = ('node', 'group', 'relationship') TEMPLATE_NAME_SECTIONS = { 'node': 'node_templates', 'group': 'groups', @@ -59,7 +58,7 @@ NOT_A_DICT = ('null', 'true', 'a string', '123', '0.123', '[]') NOT_A_DICT_OR_STRING = ('null', 'true', '123', '0.123', '[]') NOT_A_LIST = ('null', 'true', 'a string', '123', '0.123', '{}') NOT_A_STRING = ('null', 'true', '123', '0.123', '[]', '{}') -NOT_A_BOOL = ('null', '123', '0.123', '[]', '{}') +NOT_A_BOOL = ('null', 'a string', '123', '0.123', '[]', '{}') NOT_A_RANGE = NOT_A_LIST + ( '[]', '[ 1 ]', '[ 1, 2, 3 ]', '[ 1, 1 ]', '[ 2, 1 ]', http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py index ba55fc8..16ca777 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_interface.py @@ -14,370 +14,562 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix + + +MAIN_MACROS = """ +{% macro additions() %} +{%- endmacro %} +{% macro type_interfaces() %} + interfaces: {{ caller()|indent(6) }} +{%- endmacro %} +{% macro interfaces() %} + interfaces: {{ caller()|indent(8) }} +{%- endmacro %} +""" + +RELATIONSHIP_MACROS = """ +{% macro additions() %} +capability_types: + MyType: {} +relationship_types: + MyType: {} +{%- endmacro %} +{% macro type_interfaces() %} + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType + interfaces: {{ caller()|indent(14) }} +{%- endmacro %} +{% macro interfaces() %} + requirements: + - my_requirement: + relationship: + interfaces: {{ caller()|indent(16) }} +{%- endmacro %} +""" + +RELATIONSHIP_TYPE_MACROS = """ +{% macro additions() %} +capability_types: + MyType: {} +{%- endmacro %} +{% macro type_interfaces() %} + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType +relationship_types: + MyType: + interfaces: {{ caller()|indent(6) }} +{%- endmacro %} +{% macro interfaces() %} + requirements: + - my_requirement: + relationship: + interfaces: {{ caller()|indent(16) }} +{%- endmacro %} +""" + +RELATIONSHIP_TEMPLATE_MACROS = """ +{% macro additions() %} +capability_types: + MyType: {} +{%- endmacro %} +{% macro type_interfaces() %} + requirements: + - my_requirement: + capability: MyType + relationship: + type: MyType +relationship_types: + MyType: + interfaces: {{ caller()|indent(6) }} +{%- endmacro %} +{% macro interfaces() %} + requirements: + - my_requirement: + relationship: my_template + relationship_templates: + my_template: + type: MyType + interfaces: {{ caller()|indent(8) }} +{%- endmacro %} +""" + +MACROS = { + 'main': MAIN_MACROS, + 'relationship': RELATIONSHIP_MACROS, + 'relationship-type': RELATIONSHIP_TYPE_MACROS, + 'relationship-template': RELATIONSHIP_TEMPLATE_MACROS +} + +INTERFACE_SECTIONS = ( + ('main', 'node'), + ('main', 'group'), + ('main', 'relationship'), + ('relationship', 'node'), + ('relationship-type', 'node'), + ('relationship-template', 'node') +) # Syntax [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_DICT [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_DICT, + counts=(2, 1) )) -def test_template_interfaces_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interfaces_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: - MyType: {} + MyType: +{%- call type_interfaces() -%} +{} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: {{ value }} +{%- call interfaces() -%} +{{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interfaces_empty(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interfaces_syntax_empty(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: - MyType: {} + MyType: +{%- call type_interfaces() -%} +{} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: {} +{%- call interfaces() -%} +{} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_DICT [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_DICT, + counts=(2, 1) )) -def test_template_interface_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interface_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: {{ value }} +{%- call interfaces() %} +MyInterface: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_empty(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_syntax_empty(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: {} +{%- call interfaces() %} +MyInterface: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_DICT [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_DICT, + counts=(2, 1) )) -def test_template_interface_inputs_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interface_inputs_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - inputs: {{ value }} +{%- call interfaces() %} +MyInterface: + inputs: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_inputs_empty(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_inputs_syntax_empty(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - inputs: {} +{%- call interfaces() %} +MyInterface: + inputs: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_DICT_OR_STRING [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_DICT_OR_STRING, + counts=(2, 1) )) -def test_template_interface_operation_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interface_operation_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_empty(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_syntax_empty(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: {} +{%- call interfaces() %} +MyInterface: + my_operation: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_DICT_OR_STRING [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_DICT_OR_STRING, + counts=(2, 1) )) -def test_template_interface_operation_implementation_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interface_operation_implementation_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - implementation: {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: + implementation: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_implementation_unsupported_field(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_implementation_syntax_unsupported(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - implementation: - unsupported: {} +{%- call interfaces() %} +MyInterface: + my_operation: + implementation: + unsupported: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_failure() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_STRING [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_STRING, + counts=(2, 1) +)) +def test_template_interface_operation_implementation_primary_syntax_type(parser, macros, name, + value): + parser.parse_literal(MACROS[macros] + """ +tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} +interface_types: + MyType: {} +{{ name }}_types: + MyType: +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} +topology_template: + {{ section }}: + my_template: + type: MyType +{%- call interfaces() %} +MyInterface: + my_operation: + implementation: + primary: {{ value }} +{% endcall %} +""", dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() + + [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_LIST, + counts=(2, 1) )) -def test_template_interface_operation_implementation_primary_wrong_yaml_type(parser, name, value): - parser.parse_literal(""" +def test_template_interface_operation_implementation_dependencies_syntax_type(parser, macros, name, + value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - implementation: - primary: {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: + implementation: + dependencies: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() [email protected]('name,value', itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.NOT_A_STRING [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, + data.NOT_A_STRING, + counts=(2, 1) )) -def test_template_interface_operation_implementation_dependencies_wrong_yaml_type(parser, name, - value): - parser.parse_literal(""" +def test_template_interface_operation_implementation_dependencies_element_syntax_type(parser, + macros, name, + value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - implementation: - dependencies: - - {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: + implementation: + dependencies: + - {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], value=value)).assert_failure() # Operations [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_from_type(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_from_type(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: {} +{%- call interfaces() %} +MyInterface: + my_operation: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_from_interface_type(parser, name): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_from_interface_type(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: my_operation: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: {} +{%- call interfaces() %} +MyInterface: + my_operation: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_missing(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_missing(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: {} +{%- call interfaces() %} +MyInterface: + my_operation: {} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_failure() # Interface inputs [email protected]( - 'name,type_name,value', - ((s, v[0], v[1]) - for s, v in itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.PARAMETER_VALUES)) -) -def test_template_interface_input_from_type(parser, name, type_name, value): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name,type_name,value', matrix( + INTERFACE_SECTIONS, + data.PARAMETER_VALUES, + counts=(2, 2) +)) +def test_template_interface_input_from_type(parser, macros, name, type_name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} data_types: MyType: properties: @@ -387,34 +579,36 @@ interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - inputs: - my_input: - type: {{ type_name }} +{%- call type_interfaces() %} +MyInterface: + type: MyType + inputs: + my_input: + type: {{ type_name }} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - inputs: - my_input: {{ value }} +{%- call interfaces() %} +MyInterface: + inputs: + my_input: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], type_name=type_name, value=value)).assert_success() [email protected]( - 'name,type_name,value', - ((s, v[0], v[1]) - for s, v in itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.PARAMETER_VALUES)) -) -def test_template_interface_input_from_interface_type(parser, name, type_name, value): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name,type_name,value', matrix( + INTERFACE_SECTIONS, + data.PARAMETER_VALUES, + counts=(2, 2) +)) +def test_template_interface_input_from_interface_type(parser, macros, name, type_name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} data_types: MyType: properties: @@ -427,55 +621,60 @@ interface_types: type: {{ type_name }} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - inputs: - my_input: {{ value }} +{%- call interfaces() %} +MyInterface: + inputs: + my_input: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], type_name=type_name, value=value)).assert_success() [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_input_missing(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_input_missing(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - inputs: - my_input: a value +{%- call interfaces() %} +MyInterface: + inputs: + my_input: a value +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_failure() # Operation inputs [email protected]( - 'name,type_name,value', - ((s, v[0], v[1]) - for s, v in itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.PARAMETER_VALUES)) -) -def test_template_interface_operation_input_from_type(parser, name, type_name, value): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name,type_name,value', matrix( + INTERFACE_SECTIONS, + data.PARAMETER_VALUES, + counts=(2, 2) +)) +def test_template_interface_operation_input_from_type(parser, macros, name, type_name, value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} data_types: MyType: properties: @@ -485,36 +684,39 @@ interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: - inputs: - my_input: - type: {{ type_name }} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: + inputs: + my_input: + type: {{ type_name }} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - inputs: - my_input: {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: + inputs: + my_input: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], type_name=type_name, value=value)).assert_success() [email protected]( - 'name,type_name,value', - ((s, v[0], v[1]) - for s, v in itertools.product( - data.TEMPLATE_WITH_INTERFACE_NAMES, - data.PARAMETER_VALUES)) -) -def test_template_interface_operation_input_from_interface_type(parser, name, type_name, value): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name,type_name,value', matrix( + INTERFACE_SECTIONS, + data.PARAMETER_VALUES, + counts=(2, 2) +)) +def test_template_interface_operation_input_from_interface_type(parser, macros, name, type_name, + value): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} data_types: MyType: properties: @@ -528,71 +730,80 @@ interface_types: type: {{ type_name }} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType +{%- call type_interfaces() %} +MyInterface: + type: MyType +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - inputs: - my_input: {{ value }} +{%- call interfaces() %} +MyInterface: + my_operation: + inputs: + my_input: {{ value }} +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], type_name=type_name, value=value)).assert_success() @pytest.mark.skip(reason='fix') [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_operation_input_missing(parser, name): - parser.parse_literal(""" [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_operation_input_missing(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: MyType: {} {{ name }}_types: MyType: - interfaces: - MyInterface: - type: MyType - my_operation: {} +{%- call type_interfaces() %} +MyInterface: + type: MyType + my_operation: {} +{% endcall %} topology_template: {{ section }}: my_template: type: MyType - interfaces: - MyInterface: - my_operation: - inputs: - my_input: a value +{%- call interfaces() %} +MyInterface: + my_operation: + inputs: + my_input: a value +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_failure() # Unicode [email protected]('name', data.TEMPLATE_WITH_INTERFACE_NAMES) -def test_template_interface_unicode(parser, name): - parser.parse_literal(""" [email protected](reason='fix for relationships') [email protected]('macros,name', INTERFACE_SECTIONS) +def test_template_interface_unicode(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} interface_types: é¡å: {} {{ name }}_types: é¡å: - interfaces: - æ¥å£: - type: é¡å - æè¡: - inputs: - è¼¸å ¥: - type: string +{%- call type_interfaces() %} +æ¥å£: + type: é¡å + æè¡: + inputs: + è¼¸å ¥: + type: string +{% endcall %} topology_template: {{ section }}: 模æ¿: type: é¡å - interfaces: - æ¥å£: - æè¡: - inputs: - è¼¸å ¥: å¼ +{%- call interfaces() %} +æ¥å£: + æè¡: + inputs: + è¼¸å ¥: å¼ +{% endcall %} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name])).assert_success() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_parameters.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_parameters.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_parameters.py index 009c608..4f839ce 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_parameters.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_template_parameters.py @@ -14,23 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix # Syntax [email protected]( - 'name,parameter_section,value', - ((s[0], s[1], v) - for s, v in itertools.product( - data.TEMPLATE_PARAMETER_SECTIONS, - data.NOT_A_DICT)) -) -def test_template_parameter_section_wrong_yaml_type(parser, name, parameter_section, value): [email protected]('name,parameter_section,value', matrix( + data.TEMPLATE_PARAMETER_SECTIONS, + data.NOT_A_DICT, + counts=(2, 1) +)) +def test_template_parameter_section_syntax_type(parser, name, parameter_section, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -45,7 +42,7 @@ topology_template: @pytest.mark.parametrize('name,parameter_section', data.TEMPLATE_PARAMETER_SECTIONS) -def test_template_parameter_section_empty(parser, name, parameter_section): +def test_template_parameter_section_syntax_empty(parser, name, parameter_section): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -60,7 +57,7 @@ topology_template: @pytest.mark.parametrize('name,parameter_section', data.TEMPLATE_PARAMETER_SECTIONS) -def test_template_parameter_unsupported_field(parser, name, parameter_section): +def test_template_parameter_syntax_unsupported(parser, name, parameter_section): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -71,7 +68,7 @@ topology_template: type: MyType {{ parameter_section }}: my_parameter: - unsupported + unsupported: {} """, dict(name=name, section=data.TEMPLATE_NAME_SECTIONS[name], parameter_section=parameter_section)).assert_failure() @@ -97,7 +94,7 @@ topology_template: parameter_section=parameter_section)).assert_failure() [email protected]('name,type_name', itertools.product( [email protected]('name,type_name', matrix( data.TEMPLATE_NAMES, data.PARAMETER_TYPE_NAMES )) @@ -122,7 +119,7 @@ topology_template: type_name=type_name)).assert_failure() [email protected]('name,type_name', itertools.product( [email protected]('name,type_name', matrix( data.TEMPLATE_NAMES, data.PARAMETER_TYPE_NAMES )) @@ -148,13 +145,11 @@ topology_template: type_name=type_name)).assert_success() [email protected]( - 'name,type_name,value', - ((s, v[0], v[1]) - for s, v in itertools.product( - data.TEMPLATE_NAMES, - data.PARAMETER_VALUES)) -) [email protected]('name,type_name,value', matrix( + data.TEMPLATE_NAMES, + data.PARAMETER_VALUES, + counts=(1, 2) +)) def test_template_property_required_with_default(parser, name, type_name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -179,13 +174,11 @@ topology_template: # Entry schema [email protected]( - 'name,parameter_section,values', - ((s[0], s[1], v) - for s, v in itertools.product( - data.TEMPLATE_PARAMETER_SECTIONS, - data.ENTRY_SCHEMA_VALUES)) -) [email protected]('name,parameter_section,values', matrix( + data.TEMPLATE_PARAMETER_SECTIONS, + data.ENTRY_SCHEMA_VALUES, + counts=(2, 1) +)) def test_template_parameter_map(parser, name, parameter_section, values): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -213,13 +206,11 @@ topology_template: values=values)).assert_success() [email protected]( - 'name,parameter_section,values', - ((s[0], s[1], v) - for s, v in itertools.product( - data.TEMPLATE_PARAMETER_SECTIONS, - data.ENTRY_SCHEMA_VALUES_BAD)) -) [email protected]('name,parameter_section,values', matrix( + data.TEMPLATE_PARAMETER_SECTIONS, + data.ENTRY_SCHEMA_VALUES_BAD, + counts=(2, 1) +)) def test_template_parameter_map_bad(parser, name, parameter_section, values): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -299,13 +290,11 @@ topology_template: parameter_section=parameter_section)).assert_failure() [email protected]( - 'name,parameter_section,values', - ((s[0], s[1], v) - for s, v in itertools.product( - data.TEMPLATE_PARAMETER_SECTIONS, - data.ENTRY_SCHEMA_VALUES)) -) [email protected]('name,parameter_section,values', matrix( + data.TEMPLATE_PARAMETER_SECTIONS, + data.ENTRY_SCHEMA_VALUES, + counts=(2, 1) +)) def test_template_parameter_list(parser, name, parameter_section, values): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -333,13 +322,11 @@ topology_template: values=values)).assert_success() [email protected]( - 'name,parameter_section,values', - ((s[0], s[1], v) - for s, v in itertools.product( - data.TEMPLATE_PARAMETER_SECTIONS, - data.ENTRY_SCHEMA_VALUES_BAD)) -) [email protected]('name,parameter_section,values', matrix( + data.TEMPLATE_PARAMETER_SECTIONS, + data.ENTRY_SCHEMA_VALUES_BAD, + counts=(2, 1) +)) def test_template_parameter_list_bad(parser, name, parameter_section, values): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_templates.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_templates.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_templates.py index ef2ffcf..7facf4d 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_templates.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/common/test_templates.py @@ -14,17 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix # Syntax @pytest.mark.parametrize('name', data.TEMPLATE_NAMES) -def test_template_unsupported_field(parser, name): +def test_template_syntax_unsupported(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: @@ -36,11 +35,11 @@ topology_template: # Description [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TEMPLATE_NAMES, data.NOT_A_STRING )) -def test_template_description_wrong_yaml_type(parser, name, value): +def test_template_description_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: @@ -52,11 +51,11 @@ topology_template: # Type [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TEMPLATE_NAMES, data.NOT_A_STRING )) -def test_template_type_wrong_yaml_type(parser, name, value): +def test_template_type_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_group.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_group.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_group.py index 5a784c3..fc7a7d4 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_group.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_group.py @@ -22,7 +22,7 @@ from .. import data # Members @pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_group_members_wrong_yaml_type(parser, value): +def test_group_members_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 group_types: @@ -36,7 +36,7 @@ topology_template: @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_group_members_element_wrong_yaml_type(parser, value): +def test_group_members_syntax_element_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 group_types: @@ -49,7 +49,7 @@ topology_template: """, dict(value=value)).assert_failure() -def test_group_members_empty(parser): +def test_group_members_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 group_types: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_policy_template.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_policy_template.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_policy_template.py index 6ad6317..e14534b 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_policy_template.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_policy_template.py @@ -22,7 +22,7 @@ from .. import data # Targets @pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_policy_template_targets_wrong_yaml_type(parser, value): +def test_policy_template_targets_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 policy_types: @@ -36,7 +36,7 @@ topology_template: @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_policy_template_targets_element_wrong_yaml_type(parser, value): +def test_policy_template_targets_syntax_element_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 policy_types: @@ -49,7 +49,7 @@ topology_template: """, dict(value=value)).assert_failure() -def test_policy_template_targets_empty(parser): +def test_policy_template_targets_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 policy_types: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_topology_template.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_topology_template.py b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_topology_template.py index 0beed88..e45f07d 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_topology_template.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/templates/test_topology_template.py @@ -14,24 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from .. import data +from .....mechanisms.utils import matrix # Syntax @pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_topology_template_wrong_yaml_type(parser, value): +def test_topology_template_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: {{ value }} """, dict(value=value)).assert_failure() -def test_topology_template_unsupported_field(parser): +def test_topology_template_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: @@ -39,18 +38,18 @@ topology_template: """).assert_failure() -def test_topology_template_empty(parser): +def test_topology_template_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: {} """).assert_success() [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TEMPLATE_NAMES, data.NOT_A_DICT )) -def test_topology_template_template_section_wrong_yaml_type(parser, name, value): +def test_topology_template_template_section_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: @@ -59,7 +58,7 @@ topology_template: @pytest.mark.parametrize('name', data.TEMPLATE_NAMES) -def test_topology_template_template_section_empty(parser, name): +def test_topology_template_template_section_syntax_empty(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 c098c8f..ac73b1b 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 @@ -54,13 +54,14 @@ def repository(): # Syntax @pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_imports_wrong_yaml_type(parser, value): +def test_imports_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 imports: {{ value }} """, dict(value=value)).assert_failure() -def test_imports_unsupported_field(parser): + +def test_imports_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 imports: @@ -68,7 +69,7 @@ imports: """).assert_failure() -def test_imports_empty(parser): +def test_imports_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 imports: [] http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 74e550b..327c4f5 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 @@ -14,26 +14,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from . import data +from ....mechanisms.utils import matrix NORMATIVE_FIELD_NAMES = ('template_name', 'template_author', 'template_version') + # Syntax @pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_metadata_wrong_yaml_type(parser, value): +def test_metadata_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 metadata: {{ value }} """, dict(value=value)).assert_failure() -def test_metadata_empty(parser): +def test_metadata_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 metadata: {} @@ -42,11 +42,11 @@ metadata: {} # Fields [email protected]('field,value', itertools.product( [email protected]('field,value', matrix( NORMATIVE_FIELD_NAMES, data.NOT_A_STRING )) -def test_metadata_normative_fields_wrong_yaml_type(parser, field, value): +def test_metadata_normative_fields_syntax_type(parser, field, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 metadata: @@ -55,7 +55,7 @@ metadata: @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_metadata_non_normative_fields_wrong_yaml_type(parser, value): +def test_metadata_non_normative_fields_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 metadata: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py b/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py index 736c7fe..bef2ca6 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/test_service_template.py @@ -17,7 +17,7 @@ # Syntax -def test_service_template_unsupported_field(parser): +def test_service_template_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 unsupported: {} http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py index 65f708c..8bdbf76 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py @@ -14,11 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix MAIN_MACROS = """ @@ -61,12 +60,43 @@ INTERFACE_SECTIONS = ( # Syntax [email protected]( - 'macros,name,value', - ((s[0], s[1], v) - for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_DICT)) -) -def test_type_interface_wrong_yaml_type(parser, macros, name, value): + [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_DICT, + counts=(2, 1) +)) +def test_type_interface_section_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ +tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} +interface_types: + MyType: {} +{{ name }}_types: + MyType: +{%- call interfaces() -%} +{{ value }} +{% endcall %} +""", dict(name=name, value=value)).assert_failure() + + [email protected]('macros,name', INTERFACE_SECTIONS) +def test_type_interface_section_syntax_empty(parser, macros, name): + parser.parse_literal(MACROS[macros] + """ +tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} +{{ name }}_types: + MyType: +{%- call interfaces() -%} +{} +{% endcall %} +""", dict(name=name)).assert_success() + + [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_DICT, + counts=(2, 1) +)) +def test_type_interface_syntax_type(parser, macros, name, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -75,20 +105,20 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: {{ value }} +MyInterface: {{ value }} {% endcall %} """, dict(name=name, value=value)).assert_failure() @pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS) -def test_type_interface_empty(parser, macros, name): +def test_type_interface_syntax_empty(parser, macros, name): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: {} # "type" is required +MyInterface: {} # "type" is required {% endcall %} """, dict(name=name)).assert_failure() @@ -107,13 +137,13 @@ interface_types: {{ name }}_types: MyType1: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType1 {% endcall %} MyType2: derived_from: MyType1 {%- call interfaces() %} -my_interface: +MyInterface: type: MyType2 {% endcall %} """, dict(name=name)).assert_success() @@ -132,13 +162,13 @@ interface_types: {{ name }}_types: MyType1: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType2 {% endcall %} MyType2: derived_from: MyType1 {%- call interfaces() %} -my_interface: +MyInterface: type: MyType1 {% endcall %} """, dict(name=name)).assert_failure() @@ -146,8 +176,28 @@ my_interface: # Operations [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_DICT_OR_STRING, + counts=(2, 1) +)) +def test_type_interface_operation_syntax_type(parser, macros, name, value): + parser.parse_literal(MACROS[macros] + """ +tosca_definitions_version: tosca_simple_yaml_1_0 +{{- additions() }} +interface_types: + MyType: {} +{{ name }}_types: + MyType: +{%- call interfaces() %} +MyInterface: + type: MyType + my_operation: {{ value }} +{% endcall %} +""", dict(name=name, value=value)).assert_failure() + + @pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS) -def test_type_interface_operation_empty(parser, macros, name): +def test_type_interface_operation_syntax_empty(parser, macros, name): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -156,7 +206,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: {} {% endcall %} @@ -165,12 +215,11 @@ my_interface: # Operation description [email protected]( - 'macros,name,value', - ((s[0], s[1], v) - for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_DICT)) -) -def test_type_interface_operation_description_wrong_yaml_type(parser, macros, name, value): [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_STRING, + counts=(2, 1) +)) +def test_type_interface_operation_description_syntax_type(parser, macros, name, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -179,12 +228,13 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: description: {{ value }} {% endcall %} -""", dict(name=name)).assert_failure() +""", dict(name=name, value=value)).assert_failure() + @pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS) def test_type_interface_operation_description(parser, macros, name): @@ -196,7 +246,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: description: a description @@ -216,7 +266,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: implementation: an implementation @@ -234,7 +284,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: implementation: @@ -246,13 +296,11 @@ my_interface: """, dict(name=name)).assert_success() [email protected]( - 'macros,name,value', - ((s[0], s[1], v) - for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_STRING)) -) -def test_type_interface_operation_implementation_primary_wrong_yaml_type(parser, macros, name, - value): [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_STRING, + counts=(2, 1) +)) +def test_type_interface_operation_implementation_primary_syntax_type(parser, macros, name, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -261,7 +309,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: implementation: @@ -270,13 +318,12 @@ my_interface: """, dict(name=name, value=value)).assert_failure() [email protected]( - 'macros,name,value', - ((s[0], s[1], v) - for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_LIST)) -) -def test_type_interface_operation_implementation_dependencies_wrong_yaml_type(parser, macros, name, - value): [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_LIST, + counts=(2, 1) +)) +def test_type_interface_operation_implementation_dependencies_syntax_type(parser, macros, name, + value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -285,7 +332,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: implementation: @@ -295,15 +342,12 @@ my_interface: """, dict(name=name, value=value)).assert_failure() [email protected]( - 'macros,name,value', - ((s[0], s[1], v) - for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_STRING)) -) -def test_type_interface_operation_implementation_dependencies_element_wrong_yaml_type(parser, - macros, - name, - value): [email protected]('macros,name,value', matrix( + INTERFACE_SECTIONS, data.NOT_A_STRING, + counts=(2, 1) +)) +def test_type_interface_operation_implementation_dependencies_syntax_element_type(parser, macros, + name, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -312,7 +356,7 @@ interface_types: {{ name }}_types: MyType: {%- call interfaces() %} -my_interface: +MyInterface: type: MyType my_operation: implementation: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 index 2fd67b0..9bde35b 100644 --- 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 @@ -14,11 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix MAIN_MACROS = """ @@ -182,12 +181,12 @@ PROPERTY_SECTIONS = ( # Syntax [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_DICT)) -) -def test_type_parameter_section_wrong_yaml_type(parser, macros, name, parameter_section, value): [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.NOT_A_DICT, + counts=(3, 1) +)) +def test_type_parameter_section_syntax_type(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -200,7 +199,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 @pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS) -def test_type_parameter_section_empty(parser, macros, name, parameter_section): +def test_type_parameter_section_syntax_empty(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -212,12 +211,12 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name, parameter_section=parameter_section)).assert_success() [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_DICT)) -) -def test_type_parameter_wrong_yaml_type(parser, macros, name, parameter_section, value): [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.NOT_A_DICT, + counts=(3, 1) +)) +def test_type_parameter_syntax_type(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -230,7 +229,7 @@ my_parameter: {{ value }} @pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS) -def test_type_parameter_empty(parser, macros, name, parameter_section): +def test_type_parameter_syntax_empty(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -243,7 +242,7 @@ my_parameter: {} # type is required @pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS) -def test_type_parameter_unsupported_field(parser, macros, name, parameter_section): +def test_type_parameter_syntax_unsupported(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -259,12 +258,12 @@ my_parameter: # Description [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_STRING)) -) -def test_type_parameter_description_wrong_yaml_type(parser, macros, name, parameter_section, value): [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.NOT_A_STRING, + counts=(3, 1) +)) +def test_type_parameter_description_syntax_type(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -327,12 +326,12 @@ my_parameter: # Required [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PROPERTY_SECTIONS, data.NOT_A_BOOL)) -) -def test_type_parameter_required_wrong_yaml_type(parser, macros, name, parameter_section, value): [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.NOT_A_BOOL, + counts=(3, 1) +)) +def test_type_parameter_required_syntax_type(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -362,11 +361,11 @@ my_parameter: # Status [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PARAMETER_SECTIONS, data.STATUSES)) -) [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.STATUSES, + counts=(3, 1) +)) def test_type_parameter_status(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -398,13 +397,12 @@ my_parameter: # Constraints [email protected]( - 'macros,name,parameter_section,value', - ((s[0], s[1], s[2], v) - for s, v in itertools.product(PROPERTY_SECTIONS, data.NOT_A_LIST)) -) -def test_type_parameter_constraints_wrong_yaml_type(parser, macros, name, parameter_section, - value): [email protected]('macros,name,parameter_section,value', matrix( + PARAMETER_SECTIONS, + data.NOT_A_LIST, + counts=(3, 1) +)) +def test_type_parameter_constraints_syntax_type(parser, macros, name, parameter_section, value): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -419,7 +417,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS) -def test_type_parameter_constraints_empty(parser, macros, name, parameter_section): +def test_type_parameter_constraints_syntax_empty(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 {{- additions() }} @@ -433,13 +431,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section)).assert_success() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_VALUE)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_VALUE, + counts=(3, 1) +)) def test_type_parameter_constraints_with_value(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -463,13 +459,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_VALUE_LIST)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_VALUE_LIST, + counts=(3, 1) +)) def test_type_parameter_constraints_with_value_list(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -496,13 +490,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_VALUE_RANGE)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_VALUE_RANGE, + counts=(3, 1) +)) def test_type_parameter_constraints_with_value_range(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -528,13 +520,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_VALUE_RANGE)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_VALUE_RANGE, + counts=(3, 1) +)) def test_type_parameter_constraints_with_value_range_too_many(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -561,13 +551,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_failure() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_VALUE_RANGE)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_VALUE_RANGE, + counts=(3, 1) +)) def test_type_parameter_constraints_with_value_range_invalid(macros, parser, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -625,13 +613,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section)).assert_failure() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_NON_NEGATIVE_INT)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_NON_NEGATIVE_INT, + counts=(3, 1) +)) def test_type_parameter_constraints_with_integer(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ @@ -648,13 +634,11 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success() [email protected]( - 'macros,name,parameter_section,constraint', - ((s[0], s[1], s[2], v) - for s, v in itertools.product( - PROPERTY_SECTIONS, - data.CONSTRAINTS_WITH_NON_NEGATIVE_INT)) -) [email protected]('macros,name,parameter_section,constraint', matrix( + PROPERTY_SECTIONS, + data.CONSTRAINTS_WITH_NON_NEGATIVE_INT, + counts=(3, 1) +)) def test_type_parameter_constraints_with_integer_bad(parser, macros, name, parameter_section, constraint): parser.parse_literal(MACROS[macros] + """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 index 80a74ef..4a0f4d3 100644 --- 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 @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix # Syntax [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TYPE_NAMES, data.NOT_A_DICT )) -def test_type_wrong_yaml_type(parser, name, value): +def test_type_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -36,7 +35,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 @pytest.mark.parametrize('name', data.TYPE_NAMES_NO_UNSUPPORTED_FIELDS) -def test_type_unsupported_field(parser, name): +def test_type_syntax_unsupported(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -46,7 +45,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 @pytest.mark.parametrize('name', data.TYPE_NAMES) -def test_type_empty(parser, name): +def test_type_syntax_empty(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -56,11 +55,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Description [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TYPE_NAMES, data.NOT_A_STRING )) -def test_type_description_wrong_yaml_type(parser, name, value): +def test_type_description_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -81,11 +80,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Derived from [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TYPE_NAMES, data.NOT_A_STRING )) -def test_type_derived_from_wrong_yaml_type(parser, name, value): +def test_type_derived_from_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 {{ name }}_types: @@ -141,7 +140,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Version [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TYPE_NAMES, data.GOOD_VERSIONS )) @@ -154,7 +153,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name, value=value)).assert_success() [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( data.TYPE_NAMES, data.BAD_VERSIONS )) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 index 862772a..cfb8c98 100644 --- 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 @@ -14,11 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools - import pytest from ... import data +from ......mechanisms.utils import matrix + # All fields except "requirements", which is a sequenced list DICT_FIELD_NAMES = ('properties', 'attributes', 'capabilities', 'interfaces', 'artifacts') @@ -26,11 +26,11 @@ DICT_FIELD_NAMES = ('properties', 'attributes', 'capabilities', 'interfaces', 'a # Fields [email protected]('name,value', itertools.product( [email protected]('name,value', matrix( DICT_FIELD_NAMES, data.NOT_A_DICT )) -def test_node_type_fields_wrong_yaml_type(parser, name, value): +def test_node_type_fields_syntax_type(parser, name, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -40,7 +40,7 @@ node_types: @pytest.mark.parametrize('name', DICT_FIELD_NAMES) -def test_node_type_fields_empty(parser, name): +def test_node_type_fields_syntax_empty(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -49,7 +49,7 @@ node_types: """, dict(name=name)).assert_success() -def test_node_type_requirements_empty(parser): +def test_node_type_requirements_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 index 5651fe6..fba969a 100644 --- 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 @@ -21,7 +21,7 @@ from ... import data # Syntax @pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_capability_wrong_yaml_type(parser, value): +def test_node_type_capability_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -31,7 +31,7 @@ node_types: """, dict(value=value)).assert_failure() -def test_node_type_capability_unsupported_field(parser): +def test_node_type_capability_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -45,7 +45,7 @@ node_types: """).assert_failure() -def test_node_type_capability_empty(parser): +def test_node_type_capability_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -58,7 +58,7 @@ node_types: # Description @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_description_wrong_yaml_type(parser, value): +def test_node_type_capability_description_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -89,7 +89,7 @@ node_types: # Type @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_type_wrong_yaml_type(parser, value): +def test_node_type_capability_type_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -169,7 +169,7 @@ node_types: @pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_node_type_capability_valid_source_types_wrong_yaml_type(parser, value): +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: @@ -184,7 +184,7 @@ node_types: @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_capability_valid_source_types_element_wrong_yaml_type(parser, value): +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: @@ -198,7 +198,7 @@ node_types: """, dict(value=value)).assert_failure() -def test_node_type_capability_valid_source_empty(parser): +def test_node_type_capability_valid_source_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/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 index f2a2fa4..0c29595 100644 --- 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 @@ -22,7 +22,7 @@ from ... import data # Syntax @pytest.mark.parametrize('value', data.NOT_A_DICT) -def test_node_type_requirement_wrong_yaml_type(parser, value): +def test_node_type_requirement_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -32,7 +32,7 @@ node_types: """, dict(value=value)).assert_failure() -def test_node_type_requirement_unsupported_field(parser): +def test_node_type_requirement_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -46,7 +46,7 @@ node_types: """).assert_failure() -def test_node_type_requirement_empty(parser): +def test_node_type_requirement_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -59,7 +59,7 @@ node_types: # Capability @pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) -def test_node_type_requirement_capability_wrong_yaml_type(parser, value): +def test_node_type_requirement_capability_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 node_types: @@ -70,7 +70,7 @@ node_types: """, dict(value=value)).assert_failure() -def test_node_type_requirement_capability_unsupported_field(parser): +def test_node_type_requirement_capability_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -129,7 +129,7 @@ node_types: # Node @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_node_type_requirement_node_wrong_yaml_type(parser, value): +def test_node_type_requirement_node_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -182,7 +182,7 @@ node_types: # Relationship @pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING) -def test_node_type_requirement_relationship_type_wrong_yaml_type(parser, value): +def test_node_type_requirement_relationship_type_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: @@ -196,7 +196,7 @@ node_types: """, dict(value=value)).assert_failure() -def test_node_type_requirement_relationship_unsupported_field(parser): +def test_node_type_requirement_relationship_syntax_unsupported(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 capability_types: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/354328e9/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py index 1e5e1e0..0459d11 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py @@ -34,7 +34,7 @@ artifact_types: # MIME type @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_artifact_type_mime_type_wrong_yaml_type(parser, value): +def test_artifact_type_mime_type_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 artifact_types: @@ -46,7 +46,7 @@ artifact_types: # File extension @pytest.mark.parametrize('value', data.NOT_A_LIST) -def test_artifact_type_file_ext_wrong_yaml_type(parser, value): +def test_artifact_type_file_ext_syntax_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 artifact_types: @@ -55,7 +55,7 @@ artifact_types: """, dict(value=value)).assert_failure() -def test_artifact_type_file_ext_empty(parser): +def test_artifact_type_file_ext_syntax_empty(parser): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 artifact_types: @@ -65,7 +65,7 @@ artifact_types: @pytest.mark.parametrize('value', data.NOT_A_STRING) -def test_artifact_type_file_ext_element_wrong_yaml_type(parser, value): +def test_artifact_type_file_ext_syntax_element_type(parser, value): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 artifact_types:
