• 
      

    Add new API for working with default reviewers.

    Review Request #3879 — Created Feb. 17, 2013 and submitted

    Information

    Review Board
    release-1.7.x

    Reviewers

    Add new API for working with default reviewers.
    
    We never had API for default reviewers before, meaning that it was
    impossible for scripts to query or manipulate them.
    
    This introduces POST, PUT, DELETE and GET support for default reviewers.
    The functionality is pretty standard. Querying the lists, though, has
    some nice filtering to narrow down by repositories, users, and groups.
    
    To get the errors to propagate correctly, DefaultReviewerForm has been
    updated to tie any user/group/repository validation errors to the
    appropriate fields.
    
    33 new unit tests were added.
    All new unit tests pass.
    
    
    Testing the DELETE default-reviewers/<id>/ API ... ok
    Testing the DELETE default-reviewers/<id>/ API with Permission Denied error ... ok
    Testing the DELETE default-reviewers/<id>/ API with a local site ... ok
    Testing the DELETE default-reviewers/<id>/ API with a local site and Permission Denied error ... ok
    Testing the GET default-reviewers/<id>/ API ... ok
    Testing the GET default-reviewers/<id>/ API with Not Modified response ... ok
    Testing the GET default-reviewers/<id>/ API with a local site ... ok
    Testing the GET default-reviewers/<id>/ API with a local site and Permission Denied error ... ok
    Testing the GET default-reviewers/ API ... ok
    Testing the GET default-reviewers/?groups= API ... ok
    Testing the GET default-reviewers/?repositories= API ... ok
    Testing the GET default-reviewers/ API with a local site ... ok
    Testing the GET default-reviewers/ API with a local site and Permission Denied error ... ok
    Testing the GET default-reviewers/?users= API ... ok
    Testing the POST default-reviewers/ API ... ok
    Testing the POST default-reviewers/ API with field defaults ... ok
    Testing the POST default-reviewers/ API with group and invalid site ... ok
    Testing the POST default-reviewers/ API with invalid group ... ok
    Testing the POST default-reviewers/ API with invalid repository ... ok
    Testing the POST default-reviewers/ API with invalid username ... ok
    Testing the POST default-reviewers/ API with a local site and Permission Denied error ... ok
    Testing the POST default-reviewers/ API with repository and invalid site ... ok
    Testing the POST default-reviewers/ API with a local site ... ok
    Testing the POST default-reviewers/ API with user and invalid site ... ok
    Testing the PUT default-reviewers/<id>/ API ... ok
    Testing the PUT default-reviewers/<id>/ API with group and invalid site ... ok
    Testing the PUT default-reviewers/<id>/ API with invalid group ... ok
    Testing the PUT default-reviewers/<id>/ API with invalid repository ... ok
    Testing the PUT default-reviewers/<id>/ API with invalid username ... ok
    Testing the PUT default-reviewers/<id>/ API with a local site and Permission Denied error ... ok
    Testing the PUT default-reviewers/<id>/ API with repository and invalid site ... ok
    Testing the PUT default-reviewers/<id>/ API with a local site ... ok
    Testing the PUT default-reviewers/<id>/ API with user and invalid site ... ok
    
    ----------------------------------------------------------------------
    Ran 33 tests in 7.308s
    
    OK
    Description From Last Updated

    should this be "group names" instead of usernames?

    SM smacleod

    Do these need to be explicitly provided? Aren't they going to default to those values anyway?

    SM smacleod

    Col: 21 E126 continuation line over-indented for hanging indent

    reviewbotreviewbot

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (99 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (80 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (86 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (103 > 79 characters)

    reviewbotreviewbot

    Col: 13 E122 continuation line missing indentation or outdented

    reviewbotreviewbot

    Col: 9 E123 closing bracket does not match indentation of opening bracket's line

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    Col: 13 E122 continuation line missing indentation or outdented

    reviewbotreviewbot

    Col: 9 E123 closing bracket does not match indentation of opening bracket's line

    reviewbotreviewbot

    Col: 80 E501 line too long (85 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (90 > 79 characters)

    reviewbotreviewbot

    I think this test was copied and pasted identically from above?

    SM smacleod

    Col: 80 E501 line too long (98 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (103 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (89 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (106 > 79 characters)

    reviewbotreviewbot

    Col: 21 E126 continuation line over-indented for hanging indent

    reviewbotreviewbot

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (99 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (80 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (86 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (103 > 79 characters)

    reviewbotreviewbot

    Col: 13 E122 continuation line missing indentation or outdented

    reviewbotreviewbot

    Col: 9 E123 closing bracket does not match indentation of opening bracket's line

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    Col: 13 E122 continuation line missing indentation or outdented

    reviewbotreviewbot

    Col: 9 E123 closing bracket does not match indentation of opening bracket's line

    reviewbotreviewbot

    Col: 80 E501 line too long (85 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (90 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (98 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (103 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (89 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (81 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (106 > 79 characters)

    reviewbotreviewbot
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/webapi/tests.py
          reviewboard/reviews/managers.py
          reviewboard/reviews/models.py
          reviewboard/webapi/resources.py
          reviewboard/reviews/forms.py
        Ignored Files:
      
      
    2. reviewboard/webapi/resources.py (Diff revision 1)
       
       
      Show all issues
      Col: 21
       E126 continuation line over-indented for hanging indent
      
    3. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (82 > 79 characters)
      
    4. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (99 > 79 characters)
      
    5. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (80 > 79 characters)
      
    6. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    7. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (86 > 79 characters)
      
    8. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (82 > 79 characters)
      
    9. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (103 > 79 characters)
      
    10. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 13
       E122 continuation line missing indentation or outdented
      
    11. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 9
       E123 closing bracket does not match indentation of opening bracket's line
      
    12. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (84 > 79 characters)
      
    13. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 13
       E122 continuation line missing indentation or outdented
      
    14. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 9
       E123 closing bracket does not match indentation of opening bracket's line
      
    15. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (85 > 79 characters)
      
    16. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    17. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (90 > 79 characters)
      
    18. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (98 > 79 characters)
      
    19. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (103 > 79 characters)
      
    20. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (84 > 79 characters)
      
    21. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (89 > 79 characters)
      
    22. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    23. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (106 > 79 characters)
      
    24. 
        
    SM
    1. Other than a few small things, looks good to me!
    2. reviewboard/webapi/resources.py (Diff revision 1)
       
       
      Show all issues
      should this be "group names" instead of usernames?
    3. reviewboard/webapi/resources.py (Diff revision 1)
       
       
       
      Show all issues
      Do these need to be explicitly provided? Aren't they going to default to those values anyway?
    4. reviewboard/webapi/resources.py (Diff revision 1)
       
       
       
      I'm glad you added the filtering. I've come across a couple of resources which lack this sort of thing which makes it a pain.
    5. reviewboard/webapi/resources.py (Diff revision 1)
       
       
      "transmogrify"... haha nice.
    6. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Test coverage ftw :D
      
      Do we want to add a test which checks the behaviour of POSTing to a request which already has groups / users, and what happens when we provide those arguemnts (i.e. Test overwriting the previous groups / users).
    7. reviewboard/webapi/tests.py (Diff revision 1)
       
       
      Show all issues
      I think this test was copied and pasted identically from above?
    8. 
        
    chipx86
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/webapi/tests.py
          reviewboard/reviews/forms.py
          reviewboard/reviews/managers.py
          reviewboard/webapi/resources.py
          reviewboard/reviews/models.py
        Ignored Files:
      
      
    2. reviewboard/webapi/resources.py (Diff revision 2)
       
       
      Show all issues
      Col: 21
       E126 continuation line over-indented for hanging indent
      
    3. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (82 > 79 characters)
      
    4. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (99 > 79 characters)
      
    5. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (80 > 79 characters)
      
    6. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    7. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (86 > 79 characters)
      
    8. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (82 > 79 characters)
      
    9. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (103 > 79 characters)
      
    10. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 13
       E122 continuation line missing indentation or outdented
      
    11. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 9
       E123 closing bracket does not match indentation of opening bracket's line
      
    12. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (84 > 79 characters)
      
    13. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 13
       E122 continuation line missing indentation or outdented
      
    14. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 9
       E123 closing bracket does not match indentation of opening bracket's line
      
    15. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (85 > 79 characters)
      
    16. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    17. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (90 > 79 characters)
      
    18. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (98 > 79 characters)
      
    19. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (103 > 79 characters)
      
    20. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (84 > 79 characters)
      
    21. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (89 > 79 characters)
      
    22. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (81 > 79 characters)
      
    23. reviewboard/webapi/tests.py (Diff revision 2)
       
       
      Show all issues
      Col: 80
       E501 line too long (106 > 79 characters)
      
    24. 
        
    SM
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-1.6.x (05a6c2939f06b9abf94b529016d1c8f3dd57ce19)