-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api-keys): add
has_expired
to MasterAPIKey response (#3432)
- Loading branch information
1 parent
86cc3da
commit 0a28ee0
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
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,27 @@ | ||
from datetime import timedelta | ||
from typing import Any | ||
|
||
import pytest | ||
from django.urls import reverse | ||
from django.utils import timezone | ||
from rest_framework.test import APIClient | ||
|
||
|
||
@pytest.fixture() | ||
def _expired_api_key(admin_client: APIClient, organisation: int) -> dict[str, Any]: | ||
url = reverse( | ||
"api-v1:organisations:organisation-master-api-keys-list", | ||
args=[organisation], | ||
) | ||
data = { | ||
"name": "test_key", | ||
"organisation": organisation, | ||
"expiry_date": timezone.now() - timedelta(hours=1), | ||
} | ||
response = admin_client.post(url, data=data) | ||
return response.json() | ||
|
||
|
||
@pytest.fixture() | ||
def expired_api_key_prefix(_expired_api_key: dict[str, Any]) -> str: | ||
return _expired_api_key["prefix"] |
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