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:
@@ -60,7 +60,7 @@ class TestUserOauthRepository:
|
||||
) -> None:
|
||||
"""Test getting OAuth by provider user ID when it exists."""
|
||||
oauth = await user_oauth_repository.get_by_provider_user_id(
|
||||
"google", "google_123456"
|
||||
"google", "google_123456",
|
||||
)
|
||||
|
||||
assert oauth is not None
|
||||
@@ -76,7 +76,7 @@ class TestUserOauthRepository:
|
||||
) -> None:
|
||||
"""Test getting OAuth by provider user ID when it doesn't exist."""
|
||||
oauth = await user_oauth_repository.get_by_provider_user_id(
|
||||
"google", "nonexistent_id"
|
||||
"google", "nonexistent_id",
|
||||
)
|
||||
|
||||
assert oauth is None
|
||||
@@ -90,7 +90,7 @@ class TestUserOauthRepository:
|
||||
) -> None:
|
||||
"""Test getting OAuth by user ID and provider when it exists."""
|
||||
oauth = await user_oauth_repository.get_by_user_id_and_provider(
|
||||
test_user_id, "google"
|
||||
test_user_id, "google",
|
||||
)
|
||||
|
||||
assert oauth is not None
|
||||
@@ -106,7 +106,7 @@ class TestUserOauthRepository:
|
||||
) -> None:
|
||||
"""Test getting OAuth by user ID and provider when it doesn't exist."""
|
||||
oauth = await user_oauth_repository.get_by_user_id_and_provider(
|
||||
test_user_id, "github"
|
||||
test_user_id, "github",
|
||||
)
|
||||
|
||||
assert oauth is None
|
||||
@@ -183,7 +183,7 @@ class TestUserOauthRepository:
|
||||
|
||||
# Verify it's deleted by trying to find it
|
||||
deleted_oauth = await user_oauth_repository.get_by_provider_user_id(
|
||||
"twitter", "twitter_456"
|
||||
"twitter", "twitter_456",
|
||||
)
|
||||
assert deleted_oauth is None
|
||||
|
||||
@@ -240,10 +240,10 @@ class TestUserOauthRepository:
|
||||
|
||||
# Verify both exist by querying back from database
|
||||
found_google = await user_oauth_repository.get_by_user_id_and_provider(
|
||||
test_user_id, "google"
|
||||
test_user_id, "google",
|
||||
)
|
||||
found_github = await user_oauth_repository.get_by_user_id_and_provider(
|
||||
test_user_id, "github"
|
||||
test_user_id, "github",
|
||||
)
|
||||
|
||||
assert found_google is not None
|
||||
@@ -257,13 +257,13 @@ class TestUserOauthRepository:
|
||||
|
||||
# Verify we can also find them by provider_user_id
|
||||
found_google_by_provider = await user_oauth_repository.get_by_provider_user_id(
|
||||
"google", "google_user_1"
|
||||
"google", "google_user_1",
|
||||
)
|
||||
found_github_by_provider = await user_oauth_repository.get_by_provider_user_id(
|
||||
"github", "github_user_1"
|
||||
"github", "github_user_1",
|
||||
)
|
||||
|
||||
assert found_google_by_provider is not None
|
||||
assert found_github_by_provider is not None
|
||||
assert found_google_by_provider.user_id == test_user_id
|
||||
assert found_github_by_provider.user_id == test_user_id
|
||||
assert found_github_by_provider.user_id == test_user_id
|
||||
|
||||
Reference in New Issue
Block a user