MCPcopy
hub / github.com/gin-gonic/gin / TestGithubAPI

Function TestGithubAPI

githubapi_test.go:387–403  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

385}
386
387func TestGithubAPI(t *testing.T) {
388 DefaultWriter = os.Stdout
389 router := New()
390 githubConfigRouter(router)
391
392 for _, route := range githubAPI {
393 path, values := exampleFromPath(route.path)
394 w := PerformRequest(router, route.method, path)
395
396 // TEST
397 assert.Contains(t, w.Body.String(), "\"status\":\"good\"")
398 for _, value := range values {
399 str := fmt.Sprintf("\"%s\":\"%s\"", value.Key, value.Value)
400 assert.Contains(t, w.Body.String(), str)
401 }
402 }
403}
404
405func exampleFromPath(path string) (string, Params) {
406 output := new(strings.Builder)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
githubConfigRouterFunction · 0.85
exampleFromPathFunction · 0.85
PerformRequestFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected