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

Function TestIssuesService_Edit

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

Source from the content-addressed store, hash-verified

347}
348
349func TestIssuesService_Edit(t *testing.T) {
350 t.Parallel()
351 client, mux, _ := setup(t)
352
353 input := &IssueRequest{Title: Ptr("t"), Type: Ptr("bug")}
354
355 mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
356 testMethod(t, r, "PATCH")
357 testJSONBody(t, r, input)
358 fmt.Fprint(w, `{"number":1, "type": {"name": "bug"}}`)
359 })
360
361 ctx := t.Context()
362 issue, _, err := client.Issues.Edit(ctx, "o", "r", 1, input)
363 if err != nil {
364 t.Errorf("Issues.Edit returned error: %v", err)
365 }
366
367 want := &Issue{Number: Ptr(1), Type: &IssueType{Name: Ptr("bug")}}
368 if !cmp.Equal(issue, want) {
369 t.Errorf("Issues.Edit returned %+v, want %+v", issue, want)
370 }
371
372 const methodName = "Edit"
373 testBadOptions(t, methodName, func() (err error) {
374 _, _, err = client.Issues.Edit(ctx, "\n", "\n", -1, input)
375 return err
376 })
377
378 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
379 got, resp, err := client.Issues.Edit(ctx, "o", "r", 1, input)
380 if got != nil {
381 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
382 }
383 return resp, err
384 })
385}
386
387func TestIssuesService_RemoveMilestone(t *testing.T) {
388 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
EditMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…