logan
|
e1ba8b3327
|
test: query端点测试覆盖扩展 (4→22) — mock + 权限场景
TestExecuteQuery (16 tests):
- 快乐路径: SELECT成功, mask=false, save_history=false
- 安全: DDL/DML拒绝(400), guest(403), 无认证(401)
- 权限: 公共实例developer可查, 受限组403, 组成员+query:select→200, 无权限→403
- 错误: 无效instance(404), 缺参数(422), 空SQL(422), 服务异常(500)
TestSupportedTypes (6 tests):
- 4种DB类型返回, 结构字段验证
- Redis readonly_commands, MongoDB readonly_operations
- developer可访问, 无认证401
后端测试 843→895 (+52)
|
2026-05-23 15:29:07 +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 |
|