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

Function TestIssuesService_Get

github/issues_test.go:244–286  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

242}
243
244func TestIssuesService_Get(t *testing.T) {
245 t.Parallel()
246 client, mux, _ := setup(t)
247
248 mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
249 testMethod(t, r, "GET")
250 testHeader(t, r, "Accept", mediaTypeReactionsPreview)
251 fmt.Fprint(w, `{"number":1, "author_association": "MEMBER","labels": [{"url": "u", "name": "n", "color": "c"}]}`)
252 })
253
254 ctx := t.Context()
255 issue, _, err := client.Issues.Get(ctx, "o", "r", 1)
256 if err != nil {
257 t.Errorf("Issues.Get returned error: %v", err)
258 }
259
260 want := &Issue{
261 Number: Ptr(1),
262 AuthorAssociation: Ptr("MEMBER"),
263 Labels: []*Label{{
264 URL: Ptr("u"),
265 Name: Ptr("n"),
266 Color: Ptr("c"),
267 }},
268 }
269 if !cmp.Equal(issue, want) {
270 t.Errorf("Issues.Get returned %+v, want %+v", issue, want)
271 }
272
273 const methodName = "Get"
274 testBadOptions(t, methodName, func() (err error) {
275 _, _, err = client.Issues.Get(ctx, "\n", "\n", 1)
276 return err
277 })
278
279 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
280 got, resp, err := client.Issues.Get(ctx, "o", "r", 1)
281 if got != nil {
282 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
283 }
284 return resp, err
285 })
286}
287
288func TestIssuesService_Get_invalidOwner(t *testing.T) {
289 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testHeaderFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…