MCPcopy Index your code
hub / github.com/google/go-github / TestRepositoriesService_GetBranch_BadJSONResponse

Function TestRepositoriesService_GetBranch_BadJSONResponse

github/repos_test.go:992–1018  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

990}
991
992func TestRepositoriesService_GetBranch_BadJSONResponse(t *testing.T) {
993 t.Parallel()
994 tests := []struct {
995 branch string
996 urlPath string
997 }{
998 {branch: "b", urlPath: "/repos/o/r/branches/b"},
999 {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat%2fbranch-50%25"},
1000 }
1001
1002 for _, test := range tests {
1003 t.Run(test.branch, func(t *testing.T) {
1004 t.Parallel()
1005 client, mux, _ := setup(t)
1006
1007 mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) {
1008 testMethod(t, r, "GET")
1009 fmt.Fprint(w, `{"name":"n", "commit":{"sha":...truncated`)
1010 })
1011
1012 ctx := t.Context()
1013 if _, _, err := client.Repositories.GetBranch(ctx, "o", "r", test.branch, 0); err == nil {
1014 t.Error("Repositories.GetBranch returned no error; wanted JSON error")
1015 }
1016 })
1017 }
1018}
1019
1020func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t *testing.T) {
1021 t.Parallel()

Callers

nothing calls this directly

Calls 5

testMethodFunction · 0.85
setupFunction · 0.70
RunMethod · 0.45
GetBranchMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…