Added validation for API policies.

Review Request #6164 — Created July 29, 2014 and submitted

Information

Review Board
master
a53f02f...

Reviewers

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 '_'

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/tests/test_api_policy.py
        reviewboard/webapi/models.py
        reviewboard/webapi/resources/api_token.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/tests/test_api_policy.py
        reviewboard/webapi/models.py
        reviewboard/webapi/resources/api_token.py
    
    
  2. Show all issues
     undefined name '_'
    
  3. 
      
chipx86
reviewbot
  1. 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
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (67256ba)