Add web API for working with a user's list of API tokens.

Review Request #6080 — Created July 8, 2014 and submitted

Information

Review Board
master
9bd5c1b...

Reviewers

This adds new web API under /users/<username>/api-tokens/ for creating
new tokens, updating existing tokens, getting tokens, and deleting
tokens.

Only the owner of the tokens, and superusers, have any access to these
APIs.

To get the docs to generate correctly, I had to add support for a new
verbose_name field, in order for the document title to not turn 'api'
into 'Api'. Some other tweaks also had to be made to handle working with
the session state.

Unit tests pass.

Created tokens through the API. I tested with the global /api/ and with
Local Sites. Verified the Local Site associated was correct.

Built the API docs and verified that they looked correct.

This change adds 263 new tests (through mixins). It unfortunately also adds
another ~20 seconds to the test runtime.

Description From Last Updated

undefined name 'ObjectDoesNotExist'

reviewbotreviewbot

undefined name 'ObjectDoesNotExist'

reviewbotreviewbot

'User' imported but unused

reviewbotreviewbot

'add_fixtures' imported but unused

reviewbotreviewbot

'INVALID_FORM_DATA' imported but unused

reviewbotreviewbot

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

reviewbotreviewbot

undefined name 'ObjectDoesNotExist'

reviewbotreviewbot

undefined name 'ObjectDoesNotExist'

reviewbotreviewbot

'User' imported but unused

reviewbotreviewbot

'add_fixtures' imported but unused

reviewbotreviewbot

'INVALID_FORM_DATA' imported but unused

reviewbotreviewbot

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

reviewbotreviewbot
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/testing/testcase.py
        reviewboard/webapi/tests/test_api_token.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/errors.py
        reviewboard/webapi/tests/urls.py
        docs/manual/_ext/webapidocs.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        docs/manual/webapi/2.0/errors/228-token-generation-failed.rst
        docs/manual/webapi/2.0/resources/api-token-list.rst
        docs/manual/webapi/2.0/errors/index.rst
        docs/manual/scripts/dumpdata.sh
        docs/manual/webapi/2.0/resources/api-token.rst
        docs/manual/fixtures/initial_data.json
        docs/manual/webapi/2.0/resources/index.rst
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/testing/testcase.py
        reviewboard/webapi/tests/test_api_token.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/errors.py
        reviewboard/webapi/tests/urls.py
        docs/manual/_ext/webapidocs.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        docs/manual/webapi/2.0/errors/228-token-generation-failed.rst
        docs/manual/webapi/2.0/resources/api-token-list.rst
        docs/manual/webapi/2.0/errors/index.rst
        docs/manual/scripts/dumpdata.sh
        docs/manual/webapi/2.0/resources/api-token.rst
        docs/manual/fixtures/initial_data.json
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. Show all issues
     undefined name 'ObjectDoesNotExist'
    
  3. Show all issues
     undefined name 'ObjectDoesNotExist'
    
  4. Show all issues
     'User' imported but unused
    
  5. Show all issues
     'add_fixtures' imported but unused
    
  6. Show all issues
     'INVALID_FORM_DATA' imported but unused
    
  7. Show all issues
    Col: 17
     E126 continuation line over-indented for hanging indent
    
  8. 
      
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/testing/testcase.py
        reviewboard/webapi/tests/test_api_token.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/errors.py
        reviewboard/webapi/tests/urls.py
        docs/manual/_ext/webapidocs.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        docs/manual/webapi/2.0/errors/228-token-generation-failed.rst
        docs/manual/webapi/2.0/resources/api-token-list.rst
        docs/manual/webapi/2.0/errors/index.rst
        docs/manual/scripts/dumpdata.sh
        docs/manual/webapi/2.0/resources/api-token.rst
        docs/manual/fixtures/initial_data.json
        docs/manual/webapi/2.0/resources/index.rst
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/testing/testcase.py
        reviewboard/webapi/tests/test_api_token.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/errors.py
        reviewboard/webapi/tests/urls.py
        docs/manual/_ext/webapidocs.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/resources/api_token.py
        reviewboard/webapi/resources/user.py
    
    Ignored Files:
        docs/manual/webapi/2.0/errors/228-token-generation-failed.rst
        docs/manual/webapi/2.0/resources/api-token-list.rst
        docs/manual/webapi/2.0/errors/index.rst
        docs/manual/scripts/dumpdata.sh
        docs/manual/webapi/2.0/resources/api-token.rst
        docs/manual/fixtures/initial_data.json
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. Show all issues
     undefined name 'ObjectDoesNotExist'
    
  3. Show all issues
     undefined name 'ObjectDoesNotExist'
    
  4. Show all issues
     'User' imported but unused
    
  5. Show all issues
     'add_fixtures' imported but unused
    
  6. Show all issues
     'INVALID_FORM_DATA' imported but unused
    
  7. Show all issues
    Col: 17
     E126 continuation line over-indented for hanging indent
    
  8. 
      
david
  1. Ship It!

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