-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: GET /auth/token/thirdparty to list third-party tokens Add: DELETE /auth/token/{token_reference} to revoke token by reference Rename: GET /auth/info to GET /auth/token/info Add: Last usage time field "used" to AuthToken
- Loading branch information
Showing
15 changed files
with
335 additions
and
23 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
alembic/versions/2024_08_12_1036-b38d06d1364e_add_used_field_to_authtoken.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Add "used" (last usage time) field to AuthToken | ||
Revision ID: b38d06d1364e | ||
Revises: a4d5b6174fb1 | ||
Create Date: 2024-08-12 10:36:22.543968 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b38d06d1364e" | ||
down_revision = "a4d5b6174fb1" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"service_auth_tokens", | ||
sa.Column("used", sa.DateTime(), nullable=True), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("service_auth_tokens", "used") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from starlette import status | ||
|
||
from tests.client_requests import ( | ||
request_list_thirdparty_tokens, | ||
request_auth_token_info, | ||
) | ||
|
||
|
||
async def test_list_no_thirdparty_tokens(client, test_token): | ||
response = await request_list_thirdparty_tokens(client, test_token) | ||
assert response.status_code == status.HTTP_200_OK | ||
|
||
assert response.json()["list"] == [] | ||
assert response.json()["pagination"] == {"total": 0, "page": 1, "pages": 0} | ||
|
||
|
||
async def test_list_thirdparty_tokens( | ||
client, test_token, test_thirdparty_token | ||
): | ||
response = await request_auth_token_info(client, test_thirdparty_token) | ||
assert response.status_code == status.HTTP_200_OK | ||
|
||
token_info = response.json() | ||
|
||
response = await request_list_thirdparty_tokens(client, test_token) | ||
assert response.status_code == status.HTTP_200_OK | ||
|
||
assert response.json()["pagination"] == {"total": 1, "page": 1, "pages": 1} | ||
|
||
assert response.json()["list"] == [token_info] |
Oops, something went wrong.