fix: Lint fixes of core and repositories tests
All checks were successful
Backend CI / lint (push) Successful in 9m26s
Backend CI / test (push) Successful in 4m24s

This commit is contained in:
JSC
2025-08-01 09:17:20 +02:00
parent 389cfe2d6a
commit dc29915fbc
8 changed files with 135 additions and 88 deletions

View File

@@ -1,9 +1,11 @@
"""Tests for user OAuth repository."""
# ruff: noqa: ARG002
from collections.abc import AsyncGenerator
import pytest
import pytest_asyncio
from sqlalchemy.exc import IntegrityError
from sqlmodel.ext.asyncio.session import AsyncSession
from app.models.user import User
@@ -156,7 +158,9 @@ class TestUserOauthRepository:
assert updated_oauth.name == "Updated User Name"
assert updated_oauth.picture == "https://example.com/photo.jpg"
assert updated_oauth.provider == test_oauth.provider # Unchanged
assert updated_oauth.provider_user_id == test_oauth.provider_user_id # Unchanged
assert (
updated_oauth.provider_user_id == test_oauth.provider_user_id
) # Unchanged
@pytest.mark.asyncio
async def test_delete_oauth(
@@ -176,7 +180,7 @@ class TestUserOauthRepository:
"picture": None,
}
oauth = await user_oauth_repository.create(oauth_data)
oauth_id = oauth.id
_ = oauth.id # Store ID but don't use it
# Delete the OAuth record
await user_oauth_repository.delete(oauth)
@@ -206,7 +210,7 @@ class TestUserOauthRepository:
}
# This should fail due to unique constraint
with pytest.raises(Exception): # SQLAlchemy IntegrityError or similar
with pytest.raises(IntegrityError, match="UNIQUE constraint failed"):
await user_oauth_repository.create(duplicate_oauth_data)
@pytest.mark.asyncio
@@ -225,7 +229,7 @@ class TestUserOauthRepository:
"name": "Test User Google",
"picture": None,
}
google_oauth = await user_oauth_repository.create(google_oauth_data)
_ = await user_oauth_repository.create(google_oauth_data)
# Create GitHub OAuth for the same user
github_oauth_data = {
@@ -236,7 +240,7 @@ class TestUserOauthRepository:
"name": "Test User GitHub",
"picture": None,
}
github_oauth = await user_oauth_repository.create(github_oauth_data)
_ = await user_oauth_repository.create(github_oauth_data)
# Verify both exist by querying back from database
found_google = await user_oauth_repository.get_by_user_id_and_provider(