mockQueryServer returns an HTTP handler that routes to ListDatabases or Query based on the request URL path.
(databases []map[string]any, queryResp map[string]any)
| 167 | // mockQueryServer returns an HTTP handler that routes to ListDatabases or Query |
| 168 | // based on the request URL path. |
| 169 | func mockQueryServer(databases []map[string]any, queryResp map[string]any) http.Handler { |
| 170 | listHandler := mockListDatabases(databases) |
| 171 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 172 | if strings.Contains(r.URL.Path, "SQLService/Query") { |
| 173 | w.Header().Set("Content-Type", "application/json") |
| 174 | w.WriteHeader(http.StatusOK) |
| 175 | _ = json.NewEncoder(w).Encode(queryResp) |
| 176 | return |
| 177 | } |
| 178 | listHandler.ServeHTTP(w, r) |
| 179 | }) |
| 180 | } |
| 181 | |
| 182 | func TestBuildDatabaseFilter(t *testing.T) { |
| 183 | tests := []struct { |
no test coverage detected