MCPcopy Index your code
hub / github.com/google/go-github / TestIssuesService_GetLabel

Function TestIssuesService_GetLabel

github/issues_labels_test.go:62–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func 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
97func TestIssuesService_GetLabel_invalidOwner(t *testing.T) {
98 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetLabelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…