MCPcopy
hub / github.com/gotify/server / TestServe

Function TestServe

docs/swagger_test.go:13–26  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestServe(t *testing.T) {
14 mode.Set(mode.TestDev)
15 recorder := httptest.NewRecorder()
16 ctx, _ := gin.CreateTestContext(recorder)
17 withURL(ctx, "http", "example.com")
18
19 ctx.Request = httptest.NewRequest("GET", "/swagger?base="+url.QueryEscape("127.0.0.1/proxy/"), nil)
20
21 Serve(ctx)
22
23 content := recorder.Body.String()
24 assert.NotEmpty(t, content)
25 assert.Contains(t, content, "127.0.0.1/proxy/")
26}
27
28func withURL(ctx *gin.Context, scheme, host string) {
29 ctx.Set("location", &url.URL{Scheme: scheme, Host: host})

Callers

nothing calls this directly

Calls 4

SetFunction · 0.92
ServeFunction · 0.85
StringMethod · 0.80
withURLFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…