改为自动周期采集并优化首页导航
This commit is contained in:
@@ -1,22 +1,29 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.core.config import get_settings
|
||||
from app.main import create_app
|
||||
|
||||
|
||||
def test_health_endpoint_returns_app_identity() -> None:
|
||||
def test_health_endpoint_returns_app_identity(monkeypatch) -> None:
|
||||
# 健康检查只暴露服务身份,不触发Agent运行或数据库写入。
|
||||
monkeypatch.setenv("SIGNALSCOUT_ENV", "test")
|
||||
get_settings.cache_clear()
|
||||
with TestClient(create_app()) as client:
|
||||
response = client.get("/health")
|
||||
get_settings.cache_clear()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "ok"
|
||||
assert response.json()["app"] == "SignalScout"
|
||||
|
||||
|
||||
def test_home_page_returns_dashboard_shell() -> None:
|
||||
def test_home_page_returns_dashboard_shell(monkeypatch) -> None:
|
||||
# 根路径应该展示业务工作台,而不是返回接口404。
|
||||
monkeypatch.setenv("SIGNALSCOUT_ENV", "test")
|
||||
get_settings.cache_clear()
|
||||
with TestClient(create_app()) as client:
|
||||
response = client.get("/")
|
||||
get_settings.cache_clear()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "SignalScout" in response.text
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from app.agent.scheduler import build_scheduler
|
||||
from app.core.config import Settings
|
||||
|
||||
|
||||
def test_scheduler_runs_on_interval() -> None:
|
||||
# Agent默认按固定间隔自动运行,避免产品依赖用户手动触发。
|
||||
scheduler = build_scheduler(Settings(agent_interval_minutes=30))
|
||||
job = scheduler.get_job("continuous-intelligence")
|
||||
|
||||
assert job is not None
|
||||
assert job.trigger.interval.total_seconds() == 1800
|
||||
assert job.max_instances == 1
|
||||
Reference in New Issue
Block a user