Added validation for API policies.
Review Request #6164 — Created July 29, 2014 and submitted
This introduces
WebAPIToken.validate_policy
, which will look through a
policy definition and try to find any errors. It will check for required
data, data in invalid formats, policy IDs validity, and more.This is called when posting or updating a policy, and the error will be
returned in the API error.
Unit tests pass.
Tested several bits of validation manually with my policy editor change.
Description | From | Last Updated |
---|---|---|
undefined name '_' |
reviewbot |
- Change Summary:
-
Fixed a missing import.
- Commit:
-
e976e09ec290c0e669d4af8a60de6e0946a183eca53f02fb36918c5008fcbded226921ce513a9daa
-
Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/tests/test_api_policy.py reviewboard/webapi/models.py reviewboard/webapi/resources/api_token.py Tool: Pyflakes Processed Files: reviewboard/webapi/tests/test_api_policy.py reviewboard/webapi/models.py reviewboard/webapi/resources/api_token.py