MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / newTestServer

Function newTestServer

internal/tools/sofya/sofya_test.go:12–20  ·  view source on GitHub ↗
(t *testing.T, handler http.HandlerFunc)

Source from the content-addressed store, hash-verified

10)
11
12func newTestServer(t *testing.T, handler http.HandlerFunc) {
13 server := httptest.NewServer(handler)
14 oldURL := searchURL
15 searchURL = server.URL
16 t.Cleanup(func() {
17 searchURL = oldURL
18 server.Close()
19 })
20}
21
22func TestSearchSendsRequestAndFormatsResults(t *testing.T) {
23 newTestServer(t, func(w http.ResponseWriter, r *http.Request) {

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected