Laura10101 / contractor-tax-calculator

0 stars 2 forks source link

Putting rule tier returns unexpected DoesNotExist and ValidationErrors instead of graceful HTTP status codes #161

Closed Laura10101 closed 11 months ago

Laura10101 commented 11 months ago

FAILED rules_api/test_views.py::test_put_rule_tier_with_non_existent_tier_id - rules_api.models.RuleTier.DoesNotExist: RuleTier matching query does not exist. FAILED rules_api/test_views.py::test_put_rule_tier_with_null_min_value - django.core.exceptions.ValidationError: {'min_value': ['This field cannot be null.']} FAILED rules_api/test_views.py::test_put_rule_tier_with_non_numeric_min_value - django.core.exceptions.ValidationError: {'min_value': ['“abc” value must be an integer.']} FAILED rules_api/test_views.py::test_put_rule_tier_with_non_numeric_max_value - django.core.exceptions.ValidationError: {'max_value': ['“abc” value must be an integer.']} FAILED rules_api/test_views.py::test_put_rule_tier_with_null_ordinal - django.core.exceptions.ValidationError: ['ordinal must be a non-negative integer value'] FAILED rules_api/test_views.py::test_put_rule_tier_with_non_numeric_ordinal - django.core.exceptions.ValidationError: ['ordinal must be a non-negative integer value'] FAILED rules_api/test_views.py::test_put_rule_tier_with_null_tier_rate - django.core.exceptions.ValidationError: {'tier_rate': ['This field cannot be null.']} FAILED rules_api/test_views.py::test_put_rule_tier_with_non_numeric_tier_rate - django.core.exceptions.ValidationError: {'tier_rate': ['“abc” value must be a float.']}

Laura10101 commented 11 months ago

Added error handling to the PUT rule_tier endpoint to gracefully handle validation and doesnotexist errors.