Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-1-parser-test-suite 740818ad4 -> 12e860863
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12e86086/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 38e2023..c0722ed 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 @@ -148,7 +148,7 @@ MACROS = { 'capability': CAPABILITY_MACROS } -CASES = ( +PERMUTATIONS = ( ('main', 'node', 'properties'), ('main', 'node', 'attributes'), ('main', 'group', 'properties'), @@ -177,7 +177,7 @@ CASES = ( # Parameters section @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_DICT, counts=(3, 1) )) @@ -193,7 +193,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameters_section_syntax_empty(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -209,7 +209,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Parameter @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_DICT, counts=(3, 1) )) @@ -225,7 +225,7 @@ my_parameter: {{ value }} """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_syntax_empty(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -238,7 +238,7 @@ my_parameter: {} # type is required """, dict(name=name, parameter_section=parameter_section)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_syntax_unsupported(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -256,7 +256,7 @@ my_parameter: # Description @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_STRING, counts=(3, 1) )) @@ -274,7 +274,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_description(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -291,7 +291,7 @@ my_parameter: # Default [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_default(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -306,7 +306,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section)).assert_success() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_default_bad(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -324,7 +324,7 @@ my_parameter: # Status @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.STATUSES, counts=(3, 1) )) @@ -342,7 +342,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, value=value)).assert_success() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_status_bad(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -359,7 +359,7 @@ my_parameter: # Overriding [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_add(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -379,7 +379,7 @@ my_parameter2: """, dict(name=name, parameter_section=parameter_section)).assert_success() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_add_default(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -401,7 +401,7 @@ my_parameter: @pytest.mark.skip(reason='fix for node.capability and node.relationship') [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_type_override(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -428,7 +428,7 @@ my_parameter: @pytest.mark.skip(reason='fix for node.capability and node.relationship') [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_type_override_bad(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -456,7 +456,7 @@ my_parameter: # Unicode [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_unicode(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12e86086/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_properties.py ---------------------------------------------------------------------- diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_properties.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_properties.py index 6844ce6..e04462f 100644 --- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_properties.py +++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_properties.py @@ -18,16 +18,19 @@ Unified testing for properties and inputs. These tests are in addition to the common tests for parameters in test_type_parameters.py. + +Compare with test_node_template_node_filter_constraints.py. Note that though the constraints are the +same, their syntax is very different, making it difficult to test all permutations together. """ import pytest -from .test_type_parameters import (MACROS, CASES as PARAMETER_CASES) +from .test_type_parameters import (MACROS, PERMUTATIONS as PARAMETER_CASES) from ... import data from ......mechanisms.utils import matrix -CASES = tuple( +PERMUTATIONS = tuple( (macros, name, parameter_section) for macros, name, parameter_section in PARAMETER_CASES if parameter_section != 'attributes' @@ -37,7 +40,7 @@ CASES = tuple( # Required @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_BOOL, counts=(3, 1) )) @@ -55,7 +58,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_required(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -73,7 +76,7 @@ my_parameter: # Status @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.STATUSES, counts=(3, 1) )) @@ -91,7 +94,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, value=value)).assert_success() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_status_bad(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -109,7 +112,7 @@ my_parameter: # Constraints @pytest.mark.parametrize('macros,name,parameter_section,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_LIST, counts=(3, 1) )) @@ -127,7 +130,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) 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 @@ -143,7 +146,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE, counts=(3, 1) )) @@ -170,7 +173,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_LIST, counts=(3, 1) )) @@ -201,7 +204,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_RANGE, counts=(3, 1) )) @@ -231,7 +234,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_RANGE, counts=(3, 1) )) @@ -262,7 +265,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_RANGE, counts=(3, 1) )) @@ -291,7 +294,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_failure() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_constraints_pattern(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -307,7 +310,7 @@ my_parameter: """, dict(name=name, parameter_section=parameter_section)).assert_success() [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_constraints_pattern_bad(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 @@ -324,7 +327,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_NON_NEGATIVE_INT, counts=(3, 1) )) @@ -345,7 +348,7 @@ my_parameter: @pytest.mark.parametrize('macros,name,parameter_section,constraint', matrix( - CASES, + PERMUTATIONS, data.CONSTRAINTS_WITH_VALUE_NON_NEGATIVE_INT, counts=(3, 1) )) @@ -367,7 +370,7 @@ my_parameter: # Unicode [email protected]('macros,name,parameter_section', CASES) [email protected]('macros,name,parameter_section', PERMUTATIONS) def test_type_parameter_constraints_pattern_unicode(parser, macros, name, parameter_section): parser.parse_literal(MACROS[macros] + """ tosca_definitions_version: tosca_simple_yaml_1_0 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12e86086/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 2e45d8a..a175498 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 @@ -23,11 +23,11 @@ from ......mechanisms.utils import matrix CASES_WITHOUT_UNSUPPORTED_FIELDS = ('artifact', 'data', 'capability', 'relationship', 'node', 'group', 'policy') -CASES = CASES_WITHOUT_UNSUPPORTED_FIELDS + ('interface',) +PERMUTATIONS = CASES_WITHOUT_UNSUPPORTED_FIELDS + ('interface',) @pytest.mark.parametrize('name,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_DICT )) def test_type_syntax_type(parser, name, value): @@ -48,7 +48,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name)).assert_failure() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_syntax_empty(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -60,7 +60,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Description @pytest.mark.parametrize('name,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_STRING )) def test_type_description_syntax_type(parser, name, value): @@ -72,7 +72,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name, value=value)).assert_failure() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_description(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -85,7 +85,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Derived from @pytest.mark.parametrize('name,value', matrix( - CASES, + PERMUTATIONS, data.NOT_A_STRING )) def test_type_derived_from_syntax_type(parser, name, value): @@ -97,7 +97,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name, value=value)).assert_failure() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_derived_from(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -108,7 +108,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name)).assert_success() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_derived_from_unknown(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -118,7 +118,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name)).assert_failure() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_derived_from_self(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -128,7 +128,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 """, dict(name=name)).assert_failure() [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_derived_from_circular(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0 @@ -145,7 +145,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Version @pytest.mark.parametrize('name,value', matrix( - CASES, + PERMUTATIONS, data.GOOD_VERSIONS )) def test_type_version(parser, name, value): @@ -158,7 +158,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 @pytest.mark.parametrize('name,value', matrix( - CASES, + PERMUTATIONS, data.BAD_VERSIONS )) def test_type_version_bad(parser, name, value): @@ -172,7 +172,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0 # Unicode [email protected]('name', CASES) [email protected]('name', PERMUTATIONS) def test_type_unicode(parser, name): parser.parse_literal(""" tosca_definitions_version: tosca_simple_yaml_1_0
