fix: resolve Google login hydration mismatch and dynamic env load
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m42s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m42s
This commit is contained in:
23
tests/test_google_auth.py
Normal file
23
tests/test_google_auth.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
import services.auth_service as auth_svc
|
||||
from services.auth_service import get_or_create_google_user
|
||||
|
||||
def test_google_user_creation(monkeypatch):
|
||||
# Enable database for testing
|
||||
monkeypatch.setattr(auth_svc, "USE_DATABASE", True)
|
||||
monkeypatch.setattr(auth_svc, "DATABASE_AVAILABLE", True)
|
||||
|
||||
email = "google_test_user@example.com"
|
||||
name = "Google User"
|
||||
avatar_url = "https://example.com/avatar.png"
|
||||
|
||||
# Create the user
|
||||
user = get_or_create_google_user(email=email, name=name, avatar_url=avatar_url)
|
||||
assert user is not None
|
||||
assert user.email == email
|
||||
assert user.name == name
|
||||
assert user.avatar_url == avatar_url
|
||||
|
||||
# Retrieve again
|
||||
user_again = get_or_create_google_user(email=email, name=name, avatar_url="https://new-avatar.com")
|
||||
assert user_again.id == user.id
|
||||
Reference in New Issue
Block a user