Refactor test cases for improved readability and consistency
- Adjusted function signatures in various test files to enhance clarity by aligning parameters. - Updated patching syntax for better readability across test cases. - Improved formatting and spacing in test assertions and mock setups. - Ensured consistent use of async/await patterns in async test functions. - Enhanced comments for better understanding of test intentions.
This commit is contained in:
@@ -61,7 +61,8 @@ 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
|
||||
@@ -77,7 +78,8 @@ 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
|
||||
@@ -91,7 +93,8 @@ 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
|
||||
@@ -107,7 +110,8 @@ 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
|
||||
@@ -186,7 +190,8 @@ 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
|
||||
|
||||
@@ -243,10 +248,12 @@ 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
|
||||
@@ -260,10 +267,12 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user