MCPcopy Index your code
hub / github.com/coder/coder / newMockUpstream

Function newMockUpstream

enterprise/coderd/aibridge_reload_test.go:42–53  ·  view source on GitHub ↗
(t *testing.T, name string)

Source from the content-addressed store, hash-verified

40}
41
42func 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.

Callers 1

Calls 7

EncodeMethod · 0.80
HelperMethod · 0.65
AddMethod · 0.65
SetMethod · 0.65
CleanupMethod · 0.65
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected