(t *testing.T)
| 128 | } |
| 129 | |
| 130 | func TestGitService_GetCommit(t *testing.T) { |
| 131 | t.Parallel() |
| 132 | client, mux, _ := setup(t) |
| 133 | |
| 134 | mux.HandleFunc("/repos/o/r/git/commits/s", func(w http.ResponseWriter, r *http.Request) { |
| 135 | testMethod(t, r, "GET") |
| 136 | fmt.Fprint(w, `{"sha":"s","message":"Commit Message.","author":{"name":"n"}}`) |
| 137 | }) |
| 138 | |
| 139 | ctx := t.Context() |
| 140 | commit, _, err := client.Git.GetCommit(ctx, "o", "r", "s") |
| 141 | if err != nil { |
| 142 | t.Errorf("Git.GetCommit returned error: %v", err) |
| 143 | } |
| 144 | |
| 145 | want := &Commit{SHA: Ptr("s"), Message: Ptr("Commit Message."), Author: &CommitAuthor{Name: Ptr("n")}} |
| 146 | if !cmp.Equal(commit, want) { |
| 147 | t.Errorf("Git.GetCommit returned %+v, want %+v", commit, want) |
| 148 | } |
| 149 | |
| 150 | const methodName = "GetCommit" |
| 151 | testBadOptions(t, methodName, func() (err error) { |
| 152 | _, _, err = client.Git.GetCommit(ctx, "\n", "\n", "\n") |
| 153 | return err |
| 154 | }) |
| 155 | |
| 156 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 157 | got, resp, err := client.Git.GetCommit(ctx, "o", "r", "s") |
| 158 | if got != nil { |
| 159 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 160 | } |
| 161 | return resp, err |
| 162 | }) |
| 163 | } |
| 164 | |
| 165 | func TestGitService_GetCommit_invalidOwner(t *testing.T) { |
| 166 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…