Skip to content

Commit 0e16e60

Browse files
committed
Always emit N/A outcomes; they are not written to db when higher severity outcomes exist
1 parent e9e9f68 commit 0e16e60

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

features/steps/validation_handling.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,20 @@ def inner(context, **kwargs):
250250
251251
Data is circulated using the 'behave-context' and is ultimately stored in the database, as 'ValidationOutcome' corresponds to a database column.
252252
"""
253+
# this basically serves as placeholder, later only the highest severity
254+
# outcomes are retained, so the state is initiated to NOT_APPLICABLE
255+
validation_outcome = ValidationOutcome(
256+
outcome_code=ValidationOutcomeCode.NOT_APPLICABLE, # "NOT_APPLICABLE", Given statement with schema/mvd check # deactivated until code table is added to django model
257+
observed=None,
258+
expected=None,
259+
feature=context.feature.name,
260+
feature_version=misc.define_feature_version(context),
261+
severity=OutcomeSeverity.NOT_APPLICABLE,
262+
validation_task_id=context.validation_task_id
263+
)
264+
context.gherkin_outcomes.append(validation_outcome)
253265

254-
if not getattr(context, 'applicable', True):
255-
validation_outcome = ValidationOutcome(
256-
outcome_code=ValidationOutcomeCode.NOT_APPLICABLE, # "NOT_APPLICABLE", Given statement with schema/mvd check # deactivated until code table is added to django model
257-
observed=None,
258-
expected=None,
259-
feature=context.feature.name,
260-
feature_version=misc.define_feature_version(context),
261-
severity=OutcomeSeverity.NOT_APPLICABLE,
262-
validation_task_id=context.validation_task_id
263-
)
264-
context.gherkin_outcomes.append(validation_outcome)
265-
266-
else: # applicability is set to True
267-
266+
if getattr(context, 'applicable', True):
268267
step_type = context.step.step_type
269268
if step_type.lower() == 'given': # behave prefers lowercase, but accepts both
270269
handle_given(context, fn, **kwargs)

0 commit comments

Comments
 (0)