fix: Lint fixes of core and repositories tests
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user