mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-28 20:58:16 +00:00
- Move all unit tests from tests/ to tests/unittest/ - Add tests/e2e/ directory for end-to-end tests - Update conftest.py for new test structure - Add new tests for auth dependencies, policies, route injection - Add new tests for run callbacks, create store, execution artifacts - Remove obsolete tests for deleted persistence layer Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""Shared fixtures for end-to-end API tests."""
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.plugins.auth.api.schemas import _login_attempts
|
|
from app.plugins.auth.domain.config import AuthConfig
|
|
from app.plugins.auth.runtime.config_state import reset_auth_config, set_auth_config
|
|
from store.config.app_config import AppConfig, reset_app_config, set_app_config
|
|
from store.config.storage_config import StorageConfig
|
|
|
|
_TEST_SECRET = "test-secret-key-e2e-auth-minimum-32"
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(tmp_path):
|
|
"""Create a full app client backed by an isolated SQLite directory."""
|
|
from app.gateway.app import create_app
|
|
|
|
_login_attempts.clear()
|
|
reset_auth_config()
|
|
reset_app_config()
|
|
set_auth_config(AuthConfig(jwt_secret=_TEST_SECRET))
|
|
set_app_config(AppConfig(storage=StorageConfig(driver="sqlite", sqlite_dir=str(tmp_path))))
|
|
|
|
app = create_app()
|
|
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|
|
_login_attempts.clear()
|
|
reset_auth_config()
|
|
reset_app_config()
|