From c5f6362e67e2b3fa827833f8e513f5ab27820f82 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Wed, 16 Sep 2026 10:47:06 +0800 Subject: [PATCH] Update test token fixture to logout after use (#1251) --- backend/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/conftest.py b/backend/conftest.py index 5f0297ec..5b9e1e9d 100644 --- a/backend/conftest.py +++ b/backend/conftest.py @@ -27,7 +27,7 @@ def client() -> Generator: @pytest.fixture(scope='module') -def token_headers(client: TestClient) -> dict[str, str]: +def token_headers(client: TestClient) -> Generator[dict[str, str], None, None]: params = { 'username': PYTEST_USERNAME, 'password': PYTEST_PASSWORD, @@ -37,4 +37,5 @@ def token_headers(client: TestClient) -> dict[str, str]: token_type = response.json()['token_type'] access_token = response.json()['access_token'] headers = {'Authorization': f'{token_type} {access_token}'} - return headers + yield headers + client.post('/auth/logout', headers=headers)