(t *testing.T)
| 159 | } |
| 160 | |
| 161 | func TestRepositoriesService_GetCommitRaw_diff(t *testing.T) { |
| 162 | t.Parallel() |
| 163 | client, mux, _ := setup(t) |
| 164 | |
| 165 | const rawStr = "@@diff content" |
| 166 | |
| 167 | mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) { |
| 168 | testMethod(t, r, "GET") |
| 169 | testHeader(t, r, "Accept", mediaTypeV3Diff) |
| 170 | fmt.Fprint(w, rawStr) |
| 171 | }) |
| 172 | |
| 173 | ctx := t.Context() |
| 174 | got, _, err := client.Repositories.GetCommitRaw(ctx, "o", "r", "s", RawOptions{Type: Diff}) |
| 175 | if err != nil { |
| 176 | t.Fatalf("Repositories.GetCommitRaw returned error: %v", err) |
| 177 | } |
| 178 | want := rawStr |
| 179 | if got != want { |
| 180 | t.Errorf("Repositories.GetCommitRaw returned %v want %v", got, want) |
| 181 | } |
| 182 | |
| 183 | const methodName = "GetCommitRaw" |
| 184 | testBadOptions(t, methodName, func() (err error) { |
| 185 | _, _, err = client.Repositories.GetCommitRaw(ctx, "\n", "\n", "\n", RawOptions{Type: Diff}) |
| 186 | return err |
| 187 | }) |
| 188 | |
| 189 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 190 | got, resp, err := client.Repositories.GetCommitRaw(ctx, "o", "r", "s", RawOptions{Type: Diff}) |
| 191 | if got != "" { |
| 192 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want ''", methodName, got) |
| 193 | } |
| 194 | return resp, err |
| 195 | }) |
| 196 | } |
| 197 | |
| 198 | func TestRepositoriesService_GetCommitRaw_patch(t *testing.T) { |
| 199 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…