From c42086a36bbfaf9286e1c08330f25d1b06a35f4b Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Wed, 11 Jul 2018 15:20:50 -0700 Subject: [PATCH] [VVP] add decorators to test cases Adding initial set of decorators Change-Id: I1d2064c94995fe30b607e7c7b8a0faebe7426f9b Issue-ID: VVP-80 Signed-off-by: stark, steven --- ice_validator/tests/test_base_template_names.py | 2 ++ ice_validator/tests/test_base_template_outputs_consumed.py | 3 ++- ice_validator/tests/test_environment_file_structure.py | 3 ++- ice_validator/tests/test_get_file_only_reference_local_files.py | 2 ++ ice_validator/tests/test_heat_numeric_parameters.py | 3 ++- ice_validator/tests/test_heat_pairs_provided.py | 4 +++- ice_validator/tests/test_heat_parameter_section.py | 3 ++- .../tests/test_heat_template_parameters_contain_required_fields.py | 3 ++- ice_validator/tests/test_heat_template_structure.py | 3 ++- ice_validator/tests/test_nested_templates.py | 2 ++ .../tests/test_no_unused_parameters_between_env_and_templates.py | 2 ++ ice_validator/tests/test_parse_yaml.py | 2 ++ ice_validator/tests/test_referenced_and_defined_parameters_match.py | 3 ++- ice_validator/tests/test_resource_ids_alphanumeric_only.py | 3 ++- ice_validator/tests/test_servers_metadata_use_get_param.py | 3 ++- ice_validator/tests/test_unique_resources_across_all_templates.py | 3 ++- ice_validator/tests/test_volume_outputs_consumed.py | 2 ++ 17 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ice_validator/tests/test_base_template_names.py b/ice_validator/tests/test_base_template_names.py index d3fd7b4..27be5fc 100644 --- a/ice_validator/tests/test_base_template_names.py +++ b/ice_validator/tests/test_base_template_names.py @@ -41,8 +41,10 @@ from os import listdir from os import path from .helpers import check_basename_ending +from .helpers import validates +@validates('R-37028', 'R-87485', 'R-81339', 'R-87247', 'R-76057') def test_base_template_names(template_dir): ''' Check all base templates have a filename that includes "_base_". diff --git a/ice_validator/tests/test_base_template_outputs_consumed.py b/ice_validator/tests/test_base_template_outputs_consumed.py index a0eb2ef..bec40f2 100644 --- a/ice_validator/tests/test_base_template_outputs_consumed.py +++ b/ice_validator/tests/test_base_template_outputs_consumed.py @@ -37,12 +37,13 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates from os import path, sep import yaml import pytest +@validates('R-52753') def test_base_template_outputs_consumed(heat_templates): ''' Check that all outputs in the base template is consumed diff --git a/ice_validator/tests/test_environment_file_structure.py b/ice_validator/tests/test_environment_file_structure.py index d8cba6d..7213e3b 100644 --- a/ice_validator/tests/test_environment_file_structure.py +++ b/ice_validator/tests/test_environment_file_structure.py @@ -37,7 +37,7 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml import pytest @@ -54,6 +54,7 @@ def test_environment_structure(env_file): assert any(map(lambda v: v in yml, key_values)) +@validates('R-03324') def test_environment_file_contains_required_sections(env_file): ''' Check that all environments files only have the allowed sections diff --git a/ice_validator/tests/test_get_file_only_reference_local_files.py b/ice_validator/tests/test_get_file_only_reference_local_files.py index 5282ee0..6588a61 100644 --- a/ice_validator/tests/test_get_file_only_reference_local_files.py +++ b/ice_validator/tests/test_get_file_only_reference_local_files.py @@ -43,8 +43,10 @@ import pytest import re import yaml from .utils.nested_iterables import find_all_get_file_in_yml +from .helpers import validates +@validates('R-99646') def test_get_file_only_reference_local_files(yaml_file): ''' Make sure that all references to get_file only try to access local files diff --git a/ice_validator/tests/test_heat_numeric_parameters.py b/ice_validator/tests/test_heat_numeric_parameters.py index e439015..ef29987 100644 --- a/ice_validator/tests/test_heat_numeric_parameters.py +++ b/ice_validator/tests/test_heat_numeric_parameters.py @@ -37,11 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import pytest import yaml +@validates('R-88863') def test_numeric_parameter(yaml_file): ''' Make sure all numeric parameters has either `range` or `allowed_values` diff --git a/ice_validator/tests/test_heat_pairs_provided.py b/ice_validator/tests/test_heat_pairs_provided.py index 2f4b74a..c89917e 100644 --- a/ice_validator/tests/test_heat_pairs_provided.py +++ b/ice_validator/tests/test_heat_pairs_provided.py @@ -37,10 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates from os import path +@validates('R-86285', 'R-38474', 'R-81725', 'R-53433', 'R-56438', + 'R-74304', 'R-91342', 'R-94509', 'R-31141') def test_heat_pairs_provided(heat_templates, env_files, volume_templates): ''' Check that every yaml file is submitted with diff --git a/ice_validator/tests/test_heat_parameter_section.py b/ice_validator/tests/test_heat_parameter_section.py index c5d0b4c..e5792fc 100644 --- a/ice_validator/tests/test_heat_parameter_section.py +++ b/ice_validator/tests/test_heat_parameter_section.py @@ -37,7 +37,7 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import pytest import yaml @@ -68,6 +68,7 @@ def test_parameter_valid_keys(yaml_file): assert not set(invalid_params) +@validates('R-90526') def test_default_values(yaml_file): ''' Make sure no default values are set for any parameter. diff --git a/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py index 1cfc4ce..31684a5 100644 --- a/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py +++ b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py @@ -37,11 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml import pytest +@validates('R-36772', 'R-44001') def test_heat_template_parameters_contain_required_fields(yaml_file): ''' Check that all parameters in the environment diff --git a/ice_validator/tests/test_heat_template_structure.py b/ice_validator/tests/test_heat_template_structure.py index 3bbca31..0d8242e 100644 --- a/ice_validator/tests/test_heat_template_structure.py +++ b/ice_validator/tests/test_heat_template_structure.py @@ -37,7 +37,7 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml @@ -54,6 +54,7 @@ def test_heat_template_structure(yaml_file): assert any(map(lambda v: v in yml, key_values)) +@validates('27078', 'R-39402', 'R-35414') def test_heat_template_structure_contains_required_sections(yaml_file): ''' Check that all heat templates have the required sections diff --git a/ice_validator/tests/test_nested_templates.py b/ice_validator/tests/test_nested_templates.py index ce8785b..12f0f34 100644 --- a/ice_validator/tests/test_nested_templates.py +++ b/ice_validator/tests/test_nested_templates.py @@ -38,11 +38,13 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. # +from .helpers import validates import yaml from os import path from .utils.nested_files import get_list_of_nested_files +@validates('R-70276') def test_all_nested_templates_provided(yaml_files): ''' Check that all templates marked as volume templates are diff --git a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py index 03bae8f..f6ccd77 100644 --- a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py +++ b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py @@ -37,8 +37,10 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # +from .helpers import validates +@validates('R-90279') def test_no_unused_parameters_between_env_and_templates(environment_pair): ''' Check all defined parameters are used in the appropiate Heat template. diff --git a/ice_validator/tests/test_parse_yaml.py b/ice_validator/tests/test_parse_yaml.py index 74bda27..5246f33 100644 --- a/ice_validator/tests/test_parse_yaml.py +++ b/ice_validator/tests/test_parse_yaml.py @@ -39,10 +39,12 @@ # from os import path +from .helpers import validates import pytest import yaml +@validates('R-95303') def test_parse_yaml(filename): ''' Read in each .yaml or .env file. If it is successfully parsed as yaml, save diff --git a/ice_validator/tests/test_referenced_and_defined_parameters_match.py b/ice_validator/tests/test_referenced_and_defined_parameters_match.py index 7622ba1..d31831f 100644 --- a/ice_validator/tests/test_referenced_and_defined_parameters_match.py +++ b/ice_validator/tests/test_referenced_and_defined_parameters_match.py @@ -37,11 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - import yaml +from .helpers import validates from .utils.nested_iterables import find_all_get_param_in_yml +@validates('R-23664') def test_referenced_and_defined_parameters_match(yaml_file): ''' Check that all referenced parameters are actually defined diff --git a/ice_validator/tests/test_resource_ids_alphanumeric_only.py b/ice_validator/tests/test_resource_ids_alphanumeric_only.py index dc508ba..c124ea7 100644 --- a/ice_validator/tests/test_resource_ids_alphanumeric_only.py +++ b/ice_validator/tests/test_resource_ids_alphanumeric_only.py @@ -37,12 +37,13 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml import pytest import re +@validates('R-75141') def test_alphanumeric_resource_ids_only(yaml_file): ''' Check that all instance names are only using alphanumerics diff --git a/ice_validator/tests/test_servers_metadata_use_get_param.py b/ice_validator/tests/test_servers_metadata_use_get_param.py index a535544..c2d1d54 100644 --- a/ice_validator/tests/test_servers_metadata_use_get_param.py +++ b/ice_validator/tests/test_servers_metadata_use_get_param.py @@ -37,11 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml import pytest +@validates('R-97199') def test_servers_metadata_use_get_param(yaml_file): ''' Check all defined nova server instances include diff --git a/ice_validator/tests/test_unique_resources_across_all_templates.py b/ice_validator/tests/test_unique_resources_across_all_templates.py index 7682782..2d05147 100644 --- a/ice_validator/tests/test_unique_resources_across_all_templates.py +++ b/ice_validator/tests/test_unique_resources_across_all_templates.py @@ -37,11 +37,12 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - +from .helpers import validates import yaml import collections +@validates('R-16447') def test_unique_resources_across_all_yaml_files(yaml_files): ''' Check that all instance names are unique diff --git a/ice_validator/tests/test_volume_outputs_consumed.py b/ice_validator/tests/test_volume_outputs_consumed.py index 771cfd6..648a689 100644 --- a/ice_validator/tests/test_volume_outputs_consumed.py +++ b/ice_validator/tests/test_volume_outputs_consumed.py @@ -37,8 +37,10 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. # +from .helpers import validates +@validates('R-11200', 'R-89913', 'R-07443') def test_volume_outputs_consumed(heat_volume_pair): ''' Check that all outputs in a volume template is consumed -- 2.16.6