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

Function TestChecksService_ListCheckSuiteForRef

github/checks_test.go:448–512  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

446}
447
448func TestChecksService_ListCheckSuiteForRef(t *testing.T) {
449 t.Parallel()
450 client, mux, _ := setup(t)
451
452 mux.HandleFunc("/repos/o/r/commits/master/check-suites", func(w http.ResponseWriter, r *http.Request) {
453 testMethod(t, r, "GET")
454 testHeader(t, r, "Accept", mediaTypeCheckRunsPreview)
455 testFormValues(t, r, values{
456 "check_name": "testing",
457 "page": "1",
458 "app_id": "2",
459 })
460 fmt.Fprint(w, `{"total_count":1,
461 "check_suites": [{
462 "id": 1,
463 "head_sha": "deadbeef",
464 "head_branch": "master",
465 "status": "completed",
466 "conclusion": "neutral",
467 "before": "deadbeefb",
468 "after": "deadbeefa"}]}`,
469 )
470 })
471
472 opt := &ListCheckSuiteOptions{
473 CheckName: Ptr("testing"),
474 AppID: Ptr(int64(2)),
475 ListOptions: ListOptions{Page: 1},
476 }
477 ctx := t.Context()
478 checkSuites, _, err := client.Checks.ListCheckSuitesForRef(ctx, "o", "r", "master", opt)
479 if err != nil {
480 t.Errorf("Checks.ListCheckSuitesForRef return error: %v", err)
481 }
482 want := &ListCheckSuiteResults{
483 Total: Ptr(1),
484 CheckSuites: []*CheckSuite{{
485 ID: Ptr(int64(1)),
486 Status: Ptr("completed"),
487 Conclusion: Ptr("neutral"),
488 HeadSHA: Ptr("deadbeef"),
489 HeadBranch: Ptr("master"),
490 BeforeSHA: Ptr("deadbeefb"),
491 AfterSHA: Ptr("deadbeefa"),
492 }},
493 }
494
495 if !cmp.Equal(checkSuites, want) {
496 t.Errorf("Checks.ListCheckSuitesForRef returned %+v, want %+v", checkSuites, want)
497 }
498
499 const methodName = "ListCheckSuitesForRef"
500 testBadOptions(t, methodName, func() (err error) {
501 _, _, err = client.Checks.ListCheckSuitesForRef(ctx, "\n", "\n", "\n", &ListCheckSuiteOptions{})
502 return err
503 })
504
505 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {

Callers

nothing calls this directly

Calls 9

testMethodFunction · 0.85
testHeaderFunction · 0.85
testFormValuesFunction · 0.85
testBadOptionsFunction · 0.85
ListCheckSuitesForRefMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…