(t *testing.T, name string)
| 40 | } |
| 41 | |
| 42 | func newMockUpstream(t *testing.T, name string) *mockUpstream { |
| 43 | t.Helper() |
| 44 | m := &mockUpstream{name: name} |
| 45 | m.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 46 | m.hits.Add(1) |
| 47 | w.Header().Set("Content-Type", "application/json") |
| 48 | w.WriteHeader(http.StatusOK) |
| 49 | assert.NoError(t, json.NewEncoder(w).Encode(map[string]string{"upstream": name})) |
| 50 | })) |
| 51 | t.Cleanup(m.server.Close) |
| 52 | return m |
| 53 | } |
| 54 | |
| 55 | // startTestAIBridgeDaemon wires an in-process aibridged daemon onto |
| 56 | // the supplied API and subscribes it to ai_providers change events. |
no test coverage detected