chore: Enhance CI workflow summary and improve JWT token generation
CI / skip-ci-check (pull_request) Successful in 1m29s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m47s
CI / test-backend (pull_request) Successful in 3m8s
CI / build (pull_request) Successful in 2m26s
CI / secret-scanning (pull_request) Successful in 1m43s
CI / dependency-scan (pull_request) Successful in 1m35s
CI / sast-scan (pull_request) Successful in 2m46s
CI / workflow-summary (pull_request) Successful in 1m27s
CI / skip-ci-check (pull_request) Successful in 1m29s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m47s
CI / test-backend (pull_request) Successful in 3m8s
CI / build (pull_request) Successful in 2m26s
CI / secret-scanning (pull_request) Successful in 1m43s
CI / dependency-scan (pull_request) Successful in 1m35s
CI / sast-scan (pull_request) Successful in 2m46s
CI / workflow-summary (pull_request) Successful in 1m27s
This commit updates the CI workflow summary to provide a clearer overview of job results and their purposes. It also modifies the JWT token generation in the authentication API to include a unique identifier (`jti`) for both access and refresh tokens, improving token management. Additionally, the test for the token refresh endpoint is adjusted to ensure it verifies the new access token correctly.
This commit is contained in:
@@ -126,7 +126,7 @@ class TestTokenRefresh:
|
||||
"""Test token refresh endpoint."""
|
||||
|
||||
def test_refresh_token_success(
|
||||
self, test_client: TestClient, auth_token: str
|
||||
self, test_client: TestClient
|
||||
):
|
||||
"""Verify successful token refresh."""
|
||||
# Get refresh token from login
|
||||
@@ -134,7 +134,10 @@ class TestTokenRefresh:
|
||||
"/api/v1/auth/login",
|
||||
json={"username": "testadmin", "password": "testpass"}
|
||||
)
|
||||
refresh_token = login_response.json()["refresh_token"]
|
||||
assert login_response.status_code == 200
|
||||
login_data = login_response.json()
|
||||
initial_access_token = login_data["access_token"]
|
||||
refresh_token = login_data["refresh_token"]
|
||||
|
||||
# Use refresh token to get new access token
|
||||
response = test_client.post(
|
||||
@@ -146,7 +149,7 @@ class TestTokenRefresh:
|
||||
data = response.json()
|
||||
assert "access_token" in data
|
||||
assert "refresh_token" in data
|
||||
assert data["access_token"] != auth_token # Should be different token
|
||||
assert data["access_token"] != initial_access_token # Should be different token
|
||||
|
||||
def test_refresh_token_with_invalid_token(self, test_client: TestClient):
|
||||
"""Verify 401 with invalid refresh token."""
|
||||
|
||||
Reference in New Issue
Block a user