diff --git a/vitrage/common/constants.py b/vitrage/common/constants.py index af08bd6bc..991bfd163 100644 --- a/vitrage/common/constants.py +++ b/vitrage/common/constants.py @@ -51,6 +51,11 @@ class EdgeProperties(object): class EdgeLabel(object): + """Define *some* edge labels + + Note that edge labels are not restricted to the values in this class, and + other datasources can defined their own edge labels. + """ ON = 'on' CONTAINS = 'contains' CAUSES = 'causes' diff --git a/vitrage/evaluator/template_validation/status_messages.py b/vitrage/evaluator/template_validation/status_messages.py index 3925fc9f5..51c3cf18b 100644 --- a/vitrage/evaluator/template_validation/status_messages.py +++ b/vitrage/evaluator/template_validation/status_messages.py @@ -11,7 +11,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from vitrage.common.constants import EdgeLabel from vitrage.common.constants import EntityCategory from vitrage.evaluator.actions.base import action_types from vitrage.evaluator.template_schema_factory import TemplateSchemaFactory @@ -56,8 +55,6 @@ status_msgs = { 86: 'Not operator can be used only on relationships.', # relationships status messages 100-119 - 100: 'Invalid relation type. Relation type must be from types: ' - '{labels}'.format(labels=EdgeLabel.labels()), 101: 'Relationship field is required.', 102: 'Relationship definition must contain source field.', 103: 'Relationship definition must contain target field.', diff --git a/vitrage/tests/unit/evaluator/template_validation/test_template_syntax_validator.py b/vitrage/tests/unit/evaluator/template_validation/test_template_syntax_validator.py index cdf0e6024..3d4a27dd5 100644 --- a/vitrage/tests/unit/evaluator/template_validation/test_template_syntax_validator.py +++ b/vitrage/tests/unit/evaluator/template_validation/test_template_syntax_validator.py @@ -239,11 +239,9 @@ class TemplateSyntaxValidatorTest(base.BaseTest): template = file_utils.load_yaml_file(template_path) self._test_execution_with_correct_result(template) - def _test_validate_action_without_required_fields(self): - + def test_validate_action_without_required_fields(self): self._test_validate_action_without_required_field( - TemplateFields.ACTION_TYPE, - status_msgs[123]) + TemplateFields.ACTION_TYPE, 123) def _test_validate_action_without_required_field(self, field_name, @@ -254,7 +252,7 @@ class TemplateSyntaxValidatorTest(base.BaseTest): action[TemplateFields.ACTION].pop(field_name) self._test_execution_with_fault_result(template, expected_comment) - def _test_validate_action_with_invalid_datasource_action(self): + def test_validate_action_with_invalid_datasource_action(self): template = self.clone_template scenario = template[TemplateFields.SCENARIOS][0] @@ -262,7 +260,7 @@ class TemplateSyntaxValidatorTest(base.BaseTest): action_dict = action[TemplateFields.ACTION] action_dict[TemplateFields.ACTION_TYPE] = 'unknown' - self._test_execution_with_fault_result(template, status_msgs[100]) + self._test_execution_with_fault_result(template, 120) def _test_execution_with_fault_result(self, template,