(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestIssuesService_GetLabel(t *testing.T) { |
| 63 | t.Parallel() |
| 64 | client, mux, _ := setup(t) |
| 65 | |
| 66 | mux.HandleFunc("/repos/o/r/labels/n", func(w http.ResponseWriter, r *http.Request) { |
| 67 | testMethod(t, r, "GET") |
| 68 | fmt.Fprint(w, `{"url":"u", "name": "n", "color": "c", "description": "d"}`) |
| 69 | }) |
| 70 | |
| 71 | ctx := t.Context() |
| 72 | label, _, err := client.Issues.GetLabel(ctx, "o", "r", "n") |
| 73 | if err != nil { |
| 74 | t.Errorf("Issues.GetLabel returned error: %v", err) |
| 75 | } |
| 76 | |
| 77 | want := &Label{URL: Ptr("u"), Name: Ptr("n"), Color: Ptr("c"), Description: Ptr("d")} |
| 78 | if !cmp.Equal(label, want) { |
| 79 | t.Errorf("Issues.GetLabel returned %+v, want %+v", label, want) |
| 80 | } |
| 81 | |
| 82 | const methodName = "GetLabel" |
| 83 | testBadOptions(t, methodName, func() (err error) { |
| 84 | _, _, err = client.Issues.GetLabel(ctx, "\n", "\n", "\n") |
| 85 | return err |
| 86 | }) |
| 87 | |
| 88 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 89 | got, resp, err := client.Issues.GetLabel(ctx, "o", "r", "n") |
| 90 | if got != nil { |
| 91 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 92 | } |
| 93 | return resp, err |
| 94 | }) |
| 95 | } |
| 96 | |
| 97 | func TestIssuesService_GetLabel_invalidOwner(t *testing.T) { |
| 98 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…