- Change Summary:
-
- Unit tests testing session restrictions now authenticate with a WebAPIToken (improves testing and is needed for the changes in /r/6079)
- Depends On:
-
- Commit:
03ecdbff674acc139bf30c4e08fac26c94a8c86d9bd5c1b4f9b6f095f2a495d1ef307c88f29e830a- Diff:
Revision 2 (+773 -69)
Add web API for working with a user's list of API tokens.
Review Request #6080 — Created July 8, 2014 and submitted
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' |
reviewbot | |
undefined name 'ObjectDoesNotExist' |
reviewbot | |
'User' imported but unused |
reviewbot | |
'add_fixtures' imported but unused |
reviewbot | |
'INVALID_FORM_DATA' imported but unused |
reviewbot | |
Col: 17 E126 continuation line over-indented for hanging indent |
reviewbot | |
undefined name 'ObjectDoesNotExist' |
reviewbot | |
undefined name 'ObjectDoesNotExist' |
reviewbot | |
'User' imported but unused |
reviewbot | |
'add_fixtures' imported but unused |
reviewbot | |
'INVALID_FORM_DATA' imported but unused |
reviewbot | |
Col: 17 E126 continuation line over-indented for hanging indent |
reviewbot |
-
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
-
-
-
-
-
-