Refactor test files for improved readability and consistency

- Removed unnecessary blank lines and adjusted formatting in test files.
- Ensured consistent use of commas in function calls and assertions across various test cases.
- Updated import statements for better organization and clarity.
- Enhanced mock setups in tests for better isolation and reliability.
- Improved assertions to follow a consistent style for better readability.
This commit is contained in:
JSC
2025-07-31 21:37:04 +02:00
parent e69098d633
commit 8847131f24
42 changed files with 602 additions and 616 deletions

View File

@@ -49,7 +49,7 @@ class TestApiTokenDependencies:
assert result == test_user
mock_auth_service.get_user_by_api_token.assert_called_once_with(
"test_api_token_123"
"test_api_token_123",
)
@pytest.mark.asyncio
@@ -135,11 +135,11 @@ class TestApiTokenDependencies:
@pytest.mark.asyncio
async def test_get_current_user_api_token_service_exception(
self, mock_auth_service
self, mock_auth_service,
):
"""Test API token authentication with service exception."""
mock_auth_service.get_user_by_api_token.side_effect = Exception(
"Database error"
"Database error",
)
api_token_header = "test_token"
@@ -170,7 +170,7 @@ class TestApiTokenDependencies:
assert result == test_user
mock_auth_service.get_user_by_api_token.assert_called_once_with(
"test_api_token_123"
"test_api_token_123",
)
@pytest.mark.asyncio
@@ -184,7 +184,7 @@ class TestApiTokenDependencies:
@pytest.mark.asyncio
async def test_api_token_no_expiry_never_expires(
self, mock_auth_service, test_user
self, mock_auth_service, test_user,
):
"""Test API token with no expiry date never expires."""
test_user.api_token_expires_at = None