Fix 2 broken test assertions, add 22 new tests for register flow, booking email resilience, settings, and customers

This commit is contained in:
belviskhoremk
2026-05-21 00:12:28 +00:00
parent cccb6ded1d
commit 31a33593e1
6 changed files with 335 additions and 11 deletions

View File

@@ -43,8 +43,11 @@ async def test_register_with_name_field(anon_client, mock_db):
"""Frontend sends `name`, not `full_name` — both must be accepted."""
mock_db.execute = AsyncMock(return_value="INSERT 1")
with patch("app.services.auth_service._client") as mock_client:
mock_client.return_value.auth.sign_up.return_value = _supabase_session()
with patch("app.services.auth_service._admin_client") as mock_admin, \
patch("app.services.auth_service._client") as mock_client:
user = MagicMock(); user.id = "11111111-1111-1111-1111-111111111111"
mock_admin.return_value.auth.admin.create_user.return_value = MagicMock(user=user)
mock_client.return_value.auth.sign_in_with_password.return_value = _supabase_session()
r = await anon_client.post("/api/v1/auth/register", json={
"email": "new@test.com",
"password": "password123",
@@ -59,8 +62,11 @@ async def test_register_with_full_name_field(anon_client, mock_db):
"""full_name field also accepted."""
mock_db.execute = AsyncMock(return_value="INSERT 1")
with patch("app.services.auth_service._client") as mock_client:
mock_client.return_value.auth.sign_up.return_value = _supabase_session()
with patch("app.services.auth_service._admin_client") as mock_admin, \
patch("app.services.auth_service._client") as mock_client:
user = MagicMock(); user.id = "11111111-1111-1111-1111-111111111111"
mock_admin.return_value.auth.admin.create_user.return_value = MagicMock(user=user)
mock_client.return_value.auth.sign_in_with_password.return_value = _supabase_session()
r = await anon_client.post("/api/v1/auth/register", json={
"email": "new2@test.com",
"password": "password123",