Commit Graph
2 Commits
Author SHA1 Message Date
logan e591eb4583 test: announcement+dashboard测试覆盖 — 36新测试 (843→877)
test_announcement.py (24 tests):
- CRUD: 创建(空标题/过长/缺字段), 列表(空/排序/认证), 更新(标题/内容/发布/取消), 删除(404)
- 权限: dba/developer/guest各角色操作限制 (403), 未认证(401)
- 边界: 完整生命周期, 重复发布幂等

test_dashboard.py (12 new, total 14):
- 空数据库零计数, 返回8字段验证
- 创建工单/实例/用户后计数验证
- inactive用户不计入, AuditLog仅计QUERY
- developer/guest访问, 未认证401
2026-05-23 15:23:13 +08:00
loganandClaude Opus 4.7 c0c731acfc feat: TDD Phase 1 — 44 backend API tests passing
Test infrastructure:
- conftest.py with SQLite in-memory DB, isolated per-test cleanup
- pytest.ini with asyncio auto mode
- Fixtures: admin/dba/developer/guest/disabled users, tokens, test instance

Test coverage (44 tests):
- test_auth: login/logout/me/token expiry (8 tests)
- test_users: CRUD + role permissions (8 tests)
- test_instances: CRUD + connection test mock (8 tests)
- test_tickets: CRUD + review/execute workflow + pagination (11 tests)
- test_query: select/drop/delete rejection + guest deny (4 tests)
- test_dashboard: stats + auth check (2 tests)

Backend fix:
- query endpoint now catches ValueError from QueryService → 400 instead of 500

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 11:34:47 +08:00