Merge branch 'dev' into order-delivery-reply
# Conflicts: # backend/app/models/user.py # docs/demand.md # docs/funclist.md # frontend/src/features/auth/stores/auth.store.ts # dev existing problems
This commit is contained in:
commit
821bd0a62c
101 files changed
+4784
-527
No files matched your search
@@ -2,11 +2,11 @@
|
||||
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 import db
|
||||
from app.models import Agent, ChatLog, Feedback, PermissionRequest, User
|
||||
from app.services.admin.dashboard_service import (
|
||||
compute_dashboard_badges,
|
||||
compute_dashboard_summary,
|
||||
compute_legacy_dashboard_stats,
|
||||
)
|
||||
@@ -21,24 +21,10 @@ def test_compute_dashboard_summary_empty(app):
|
||||
assert summary['avg_score'] == 0.0
|
||||
|
||||
|
||||
def test_compute_dashboard_badges_counts_pending(app):
|
||||
with app.app_context():
|
||||
user = User(username='pending-u', email='p@example.com', status='pending', role='user')
|
||||
agent = Agent(name='a1', is_active=True)
|
||||
db.session.add_all([user, agent])
|
||||
db.session.flush()
|
||||
req = PermissionRequest(user_id=user.id, agent_id=agent.id, status='pending', reason='test')
|
||||
db.session.add(req)
|
||||
db.session.commit()
|
||||
|
||||
badges = compute_dashboard_badges()
|
||||
assert badges['pending_approvals'] >= 1
|
||||
assert badges['pending_requests'] >= 1
|
||||
|
||||
|
||||
def test_compute_legacy_dashboard_stats_keys(app):
|
||||
with app.app_context():
|
||||
stats = compute_legacy_dashboard_stats()
|
||||
assert 'total_users' in stats
|
||||
assert 'pending_approvals' in stats
|
||||
assert 'pending_requests' in stats
|
||||
assert 'active_agents' in stats
|
||||
assert 'total_conversations' in stats
|
||||
assert 'avg_score' in stats
|
||||
Reference in new issue
Block a user