(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestGitService_GetRef_noRefs(t *testing.T) { |
| 75 | t.Parallel() |
| 76 | client, mux, _ := setup(t) |
| 77 | |
| 78 | mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { |
| 79 | testMethod(t, r, "GET") |
| 80 | w.WriteHeader(http.StatusNotFound) |
| 81 | }) |
| 82 | |
| 83 | ctx := t.Context() |
| 84 | ref, resp, err := client.Git.GetRef(ctx, "o", "r", "refs/heads/b") |
| 85 | if err == nil { |
| 86 | t.Error("Expected HTTP 404 response") |
| 87 | } |
| 88 | if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want { |
| 89 | t.Errorf("Git.GetRef returned status %v, want %v", got, want) |
| 90 | } |
| 91 | if ref != nil { |
| 92 | t.Errorf("Git.GetRef return %+v, want nil", ref) |
| 93 | } |
| 94 | |
| 95 | const methodName = "GetRef" |
| 96 | testBadOptions(t, methodName, func() (err error) { |
| 97 | _, _, err = client.Git.GetRef(ctx, "o", "r", "refs/heads/b") |
| 98 | return err |
| 99 | }) |
| 100 | |
| 101 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 102 | got, resp, err := client.Git.GetRef(ctx, "o", "r", "refs/heads/b") |
| 103 | if got != nil { |
| 104 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 105 | } |
| 106 | return resp, err |
| 107 | }) |
| 108 | } |
| 109 | |
| 110 | func TestGitService_ListMatchingRefs_singleRef(t *testing.T) { |
| 111 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…