(t *testing.T)
| 990 | } |
| 991 | |
| 992 | func 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 | |
| 1020 | func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t *testing.T) { |
| 1021 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…