Refactor tests for improved consistency and readability
- Updated test cases in `test_auth_endpoints.py` to ensure consistent formatting and style. - Enhanced `test_socket_endpoints.py` with consistent parameter formatting and improved readability. - Cleaned up `conftest.py` by ensuring consistent parameter formatting in fixtures. - Added comprehensive tests for API token dependencies in `test_api_token_dependencies.py`. - Refactored `test_auth_service.py` to maintain consistent parameter formatting. - Cleaned up `test_oauth_service.py` by removing unnecessary imports. - Improved `test_socket_service.py` with consistent formatting and readability. - Enhanced `test_cookies.py` by ensuring consistent formatting and readability. - Introduced new tests for token utilities in `test_token_utils.py` to validate token generation and expiration logic.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"""Cookie parsing utilities for WebSocket authentication."""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def parse_cookies(cookie_header: str) -> dict[str, str]:
|
||||
@@ -18,7 +17,7 @@ def parse_cookies(cookie_header: str) -> dict[str, str]:
|
||||
return cookies
|
||||
|
||||
|
||||
def extract_access_token_from_cookies(cookie_header: str) -> Optional[str]:
|
||||
def extract_access_token_from_cookies(cookie_header: str) -> str | None:
|
||||
"""Extract access token from HTTP cookies."""
|
||||
cookies = parse_cookies(cookie_header)
|
||||
return cookies.get("access_token")
|
||||
|
||||
Reference in New Issue
Block a user