MCPcopy
hub / github.com/cli/cli / TestRepoList_invalidOwner

Function TestRepoList_invalidOwner

pkg/cmd/repo/list/list_test.go:531–566  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

529}
530
531func TestRepoList_invalidOwner(t *testing.T) {
532 ios, _, stdout, stderr := iostreams.Test()
533 ios.SetStdoutTTY(false)
534 ios.SetStdinTTY(false)
535 ios.SetStderrTTY(false)
536
537 reg := &httpmock.Registry{}
538 defer reg.Verify(t)
539
540 reg.Register(
541 httpmock.GraphQL(`query RepositoryList\b`),
542 httpmock.StringResponse(`{ "data": { "repositoryOwner": null } }`),
543 )
544
545 opts := ListOptions{
546 Owner: "nonexist",
547 IO: ios,
548 HttpClient: func() (*http.Client, error) {
549 return &http.Client{Transport: reg}, nil
550 },
551 Config: func() (gh.Config, error) {
552 return config.NewBlankConfig(), nil
553 },
554 Now: func() time.Time {
555 t, _ := time.Parse(time.RFC822, "19 Feb 21 15:00 UTC")
556 return t
557 },
558 Limit: 30,
559 Detector: &fd.DisabledDetectorMock{},
560 }
561
562 err := listRun(&opts)
563 assert.EqualError(t, err, `the owner handle "nonexist" was not recognized as either a GitHub user or an organization`)
564 assert.Equal(t, "", stderr.String())
565 assert.Equal(t, "", stdout.String())
566}

Callers

nothing calls this directly

Calls 12

VerifyMethod · 0.95
RegisterMethod · 0.95
TestFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewBlankConfigFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
listRunFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected