Laura10101 / contractor-tax-calculator

0 stars 2 forks source link

Rule API - Patch endpoints unexpectedly returning 405 errors #143

Closed Laura10101 closed 11 months ago

Laura10101 commented 11 months ago

FAILED rules_api/test_views.py::test_patch_secondary_rule_tier_with_non_existent_tier_id - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_secondary_rule_tier_with_null_tier_rate - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_secondary_rule_tier_with_non_numeric_tier_rate - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_valid_secondary_rule_tier - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_non_existent_rule_id - assert 405 == 404 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_null_name - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_null_ordinal - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_non_numeric_ordinal - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_nulL_explainer - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_null_variable_name - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_null_flat_rate - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_non_numeric_flat_rate - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_flat_rate_rule_with_negative_flat_rate - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_valid_flat_rate_rule - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_non_existent_rule_id - assert 405 == 404 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_null_name - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_null_ordinal - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_non_numeric_ordinal - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_nulL_explainer - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_tiered_rate_rule_with_null_variable_name - assert 405 == 400 FAILED rules_api/test_views.py::test_patch_valid_tiered_rate_rule - assert 405 == 200 FAILED rules_api/test_views.py::test_patch_rule_tier_with_non_existent_tier_id - assert 405 == 404

Laura10101 commented 11 months ago

The endpoints expect PUT rather than PATCH to update objects. Additionally, the URL used by the tests to patch flat_rate_rules excluded the rule ID so requests were routed to the RuleList rather than the RuleDetail view which does not support PUT requests.