# Conflicts: # backend/app/models/user.py # docs/demand.md # docs/funclist.md # frontend/src/features/auth/stores/auth.store.ts # dev existing problems
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""
|
||
tests/services/admin/test_dashboard_service.py
|
||
|
||
用途:dashboard_service 统计聚合单元测试。
|
||
说明:侧栏角标(pending_approvals / pending_requests)已随用户审批功能下线一并删除
|
||
(dev commit 07e83132「删除用户审批功能」),2026-09-29 删除对应失效用例,
|
||
legacy 统计断言对齐现役四键(total_users / active_agents / total_conversations / avg_score)。
|
||
"""
|
||
from app.services.admin.dashboard_service import (
|
||
compute_dashboard_summary,
|
||
compute_legacy_dashboard_stats,
|
||
)
|
||
|
||
|
||
def test_compute_dashboard_summary_empty(app):
|
||
with app.app_context():
|
||
summary = compute_dashboard_summary()
|
||
assert summary['agent_count'] == 0
|
||
assert summary['user_count'] == 0
|
||
assert summary['total_conversations'] == 0
|
||
assert summary['avg_score'] == 0.0
|
||
|
||
|
||
def test_compute_legacy_dashboard_stats_keys(app):
|
||
with app.app_context():
|
||
stats = compute_legacy_dashboard_stats()
|
||
assert 'total_users' in stats
|
||
assert 'active_agents' in stats
|
||
assert 'total_conversations' in stats
|
||
assert 'avg_score' in stats
|