修复前后端逻辑并完善多数据库测试
统一仪表盘、AI 回复、卡密、扫码和通知等前后端行为,补齐并发与失败恢复测试。新增 MySQL 8.4、PostgreSQL 17 持久化 Docker 功能测试和 SQLite 脱敏播种工具。
This commit is contained in:
1 parent
45f895d0c4
commit
2f20a54f30
79 files changed
+2684
-2598
No files matched your search
@@ -69,6 +69,27 @@ func TestCardEndpointsErrorBranches(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateCardRejectsUnsupportedAPITypeAndInvalidDelay(t *testing.T) {
|
||||
srv, _, cleanup := newTestServer(t)
|
||||
defer cleanup()
|
||||
h := srv.Router()
|
||||
cookie := loginHelper(t, h)
|
||||
|
||||
for _, body := range []string{
|
||||
`{"name":"API 卡密","type":"api","enabled":true}`,
|
||||
`{"name":"非法类型","type":"unknown","enabled":true}`,
|
||||
`{"name":"延时错误","type":"text","text_content":"x","delay_seconds":86401,"enabled":true}`,
|
||||
} {
|
||||
req := httptest.NewRequest(http.MethodPost, "/cards", strings.NewReader(body))
|
||||
req.AddCookie(cookie)
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusBadRequest {
|
||||
t.Fatalf("body=%s status=%d want 400", body, rec.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestProtectedEndpointsRequireAuth 受保护端点未登录应 401。
|
||||
func TestProtectedEndpointsRequireAuth(t *testing.T) {
|
||||
srv, _, cleanup := newTestServer(t)
|
||||
|
||||
Reference in new issue
Block a user