(t *testing.T)
| 269 | } |
| 270 | |
| 271 | func TestGistsService_List_authenticatedUser(t *testing.T) { |
| 272 | t.Parallel() |
| 273 | client, mux, _ := setup(t) |
| 274 | |
| 275 | mux.HandleFunc("/gists", func(w http.ResponseWriter, r *http.Request) { |
| 276 | testMethod(t, r, "GET") |
| 277 | fmt.Fprint(w, `[{"id": "1"}]`) |
| 278 | }) |
| 279 | |
| 280 | ctx := t.Context() |
| 281 | gists, _, err := client.Gists.List(ctx, "", nil) |
| 282 | if err != nil { |
| 283 | t.Errorf("Gists.List returned error: %v", err) |
| 284 | } |
| 285 | |
| 286 | want := []*Gist{{ID: Ptr("1")}} |
| 287 | if !cmp.Equal(gists, want) { |
| 288 | t.Errorf("Gists.List returned %+v, want %+v", gists, want) |
| 289 | } |
| 290 | |
| 291 | const methodName = "List" |
| 292 | testBadOptions(t, methodName, func() (err error) { |
| 293 | _, _, err = client.Gists.List(ctx, "\n", nil) |
| 294 | return err |
| 295 | }) |
| 296 | |
| 297 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 298 | got, resp, err := client.Gists.List(ctx, "", nil) |
| 299 | if got != nil { |
| 300 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 301 | } |
| 302 | return resp, err |
| 303 | }) |
| 304 | } |
| 305 | |
| 306 | func TestGistsService_List_invalidUser(t *testing.T) { |
| 307 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…