Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

bugfix: The randomly generated email by Faker actually corresponded to an existing account in the test database, causing the test to fail. (#25646)

Guangdong Liu7a626747cf27
diff --git a/api/tests/test_containers_integration_tests/services/test_webapp_auth_service.py b/api/tests/test_containers_integration_tests/services/test_webapp_auth_service.py
index 429056f5e2d..316cfe16741 100644
--- a/api/tests/test_containers_integration_tests/services/test_webapp_auth_service.py
+++ b/api/tests/test_containers_integration_tests/services/test_webapp_auth_service.py
@@ -1,3 +1,5 @@
+import time
+import uuid
from unittest.mock import patch
import pytest
@@ -248,9 +250,15 @@ class TestWebAppAuthService:
- Proper error handling for non-existent accounts
- Correct exception type and message
"""
- # Arrange: Use non-existent email
- fake = Faker()
- non_existent_email = fake.email()
+ # Arrange: Generate a guaranteed non-existent email
+ # Use UUID and timestamp to ensure uniqueness
+ unique_id = str(uuid.uuid4()).replace("-", "")
+ timestamp = str(int(time.time() * 1000000)) # microseconds
+ non_existent_email = f"nonexistent_{unique_id}_{timestamp}@test-domain-that-never-exists.invalid"
+
+ # Double-check this email doesn't exist in the database
+ existing_account = db_session_with_containers.query(Account).filter_by(email=non_existent_email).first()
+ assert existing_account is None, f"Test email {non_existent_email} already exists in database"
# Act & Assert: Verify proper error handling
with pytest.raises(AccountNotFoundError):