(t *testing.T)
| 385 | } |
| 386 | |
| 387 | func TestGistsService_Get(t *testing.T) { |
| 388 | t.Parallel() |
| 389 | client, mux, _ := setup(t) |
| 390 | |
| 391 | mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) { |
| 392 | testMethod(t, r, "GET") |
| 393 | fmt.Fprint(w, `{"id": "1"}`) |
| 394 | }) |
| 395 | |
| 396 | ctx := t.Context() |
| 397 | gist, _, err := client.Gists.Get(ctx, "1") |
| 398 | if err != nil { |
| 399 | t.Errorf("Gists.Get returned error: %v", err) |
| 400 | } |
| 401 | |
| 402 | want := &Gist{ID: Ptr("1")} |
| 403 | if !cmp.Equal(gist, want) { |
| 404 | t.Errorf("Gists.Get returned %+v, want %+v", gist, want) |
| 405 | } |
| 406 | |
| 407 | const methodName = "Get" |
| 408 | testBadOptions(t, methodName, func() (err error) { |
| 409 | _, _, err = client.Gists.Get(ctx, "\n") |
| 410 | return err |
| 411 | }) |
| 412 | |
| 413 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 414 | got, resp, err := client.Gists.Get(ctx, "1") |
| 415 | if got != nil { |
| 416 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 417 | } |
| 418 | return resp, err |
| 419 | }) |
| 420 | } |
| 421 | |
| 422 | func TestGistsService_Get_invalidID(t *testing.T) { |
| 423 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…