Skip to content

Commit

Permalink
API V3 DQC Rule - avoid using display of enum for SEVERITY_VALID
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Lara committed Jun 19, 2020
1 parent 102d559 commit e4343c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion seed/serializers/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def validate(self, data):
# Rule with SEVERITY setting of "valid" should have a Label.
severity_is_valid = self.instance.severity == Rule.SEVERITY_VALID
severity_unchanged = 'get_severity_display' not in data
severity_will_be_valid = data.get('get_severity_display') == "valid"
severity_will_be_valid = data.get('get_severity_display') == dict(Rule.SEVERITY)[Rule.SEVERITY_VALID]

if (severity_is_valid and severity_unchanged) or severity_will_be_valid:
# Defaulting to "FOO" enables a value check of either "" or None (even if key doesn't exist)
Expand Down

0 comments on commit e4343c8

Please sign in to comment.