[OAuth2Provider] Add webAPI end point for user to remove OAuth2 token from My Account page

Review Request #7964 — Created Feb. 15, 2016 and discarded

lehoangm
Review Board
master
7941
reviewboard
brennie, chipx86
A new webAPI end point is added for user to GET and DELETE a OAuth2 token given
OAuth2 token ID. The webAPI is meant to be called from My Account for user to
remove a OAuth2 token.

Command run: python ./tests/runtests.py reviewboard.webapi.tests.test_oauth2_token

Test GET for list of OAuth2 token
Test GET and DELETE for OAuth2 token

This a copy from test_api_token

  • 0
  • 0
  • 36
  • 0
  • 36
Description From Last Updated
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/resources/user.py
        reviewboard/webapi/resources/__init__.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/resources/user.py
        reviewboard/webapi/resources/__init__.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2.  'json' imported but unused
    
  3.  'ValidationError' imported but unused
    
  4.  'ObjectDoesNotExist' imported but unused
    
  5.  '_' imported but unused
    
  6.  'webapi_response_errors' imported but unused
    
  7.  'webapi_request_fields' imported but unused
    
  8.  'webapi_login_required' imported but unused
    
  9.  'NOT_LOGGED_IN' imported but unused
    
  10.  'DOES_NOT_EXIST' imported but unused
    
  11.  'PERMISSION_DENIED' imported but unused
    
  12.  'INVALID_FORM_DATA' imported but unused
    
  13.  'resources' imported but unused
    
  14. 
      
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2TokensView.js
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2TokensView.js
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2.  'Application' imported but unused
    
  3.  'oauth2_token_item_mimetype' imported but unused
    
  4. reviewboard/webapi/tests/urls.py (Diff revision 2)
     
     
    Col: 1
     E302 expected 2 blank lines, found 1
    
  5. 
      
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2TokensView.js
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/accountPrefsPage/views/oauth2TokensView.js
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2. 
      
chipx86
  1. The first couple of files just remove stuff from prior changes. Instead, you should update the prior changes to remove the code there, so that each change is a cohesive unit.

  2. reviewboard/webapi/resources/__init__.py (Diff revision 3)
     
     
     
     

    oauth2_provider is an outside module, so should belong in the same import group, in alphabetical order.

  3. reviewboard/webapi/resources/oauth2_token.py (Diff revision 3)
     
     
     
     

    Same import group.

  4. This seems to be missing a _get_queryset. It'd need one in order to limit results to the user, and to do permission checking, like other resources that are children of the user resource.

    1. Do we have a test for this? I dont it see anywhere.

  5. Blank line between these.

  6. This is an outside module, so it should be part of the next import group.

  7. reviewboard/webapi/tests/test_oauth2_token.py (Diff revision 3)
     
     
     
     
     
     
     
     
     

    Make sure things are in alphabetical order.

  8. No need for parens.

    1. parens as () not a typo for parents

  9. reviewboard/webapi/tests/test_oauth2_token.py (Diff revision 3)
     
     
     
     

    Indented too far.

  10. reviewboard/webapi/tests/test_oauth2_token.py (Diff revision 3)
     
     
     
     
     
     
     

    We don't put one argument per line. Ends up being pretty long this way.

    Same below.

    1. Discussed on Slack.
      token=random().__str__(), expires=timezone.now(), will be change to None and push to the body.
      Since we have the docstring we will try as many on a line as possible

  11. Same line, no trailing comma, since this is a function call.

  12. Blank line between these.

  13. Same line, no comma.

  14. Blank line between these.

    Same below.

  15. 
      
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2. Col: 18
     E711 comparison to None should be 'if cond is None:'
    
  3. Col: 20
     E711 comparison to None should be 'if cond is None:'
    
  4. Col: 24
     E711 comparison to None should be 'if cond is None:'
    
  5. Col: 49
     E128 continuation line under-indented for visual indent
    
  6. 
      
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2. Col: 18
     E711 comparison to None should be 'if cond is None:'
    
  3. Col: 20
     E711 comparison to None should be 'if cond is None:'
    
  4. Col: 24
     E711 comparison to None should be 'if cond is None:'
    
  5. Col: 49
     E128 continuation line under-indented for visual indent
    
  6. 
      
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/tests/test_oauth2_token.py
        reviewboard/webapi/resources/oauth2_token.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/oauth2TokenModel.js
    
    
  2. 
      
brennie
Review request changed

Status: Discarded

Loading...