MCPcopy
hub / github.com/cli/cli / TestRepoList_noVisibilityField

Function TestRepoList_noVisibilityField

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

Source from the content-addressed store, hash-verified

488}
489
490func TestRepoList_noVisibilityField(t *testing.T) {
491 ios, _, stdout, stderr := iostreams.Test()
492 ios.SetStdoutTTY(false)
493 ios.SetStdinTTY(false)
494 ios.SetStderrTTY(false)
495
496 reg := &httpmock.Registry{}
497 defer reg.Verify(t)
498
499 reg.Register(
500 httpmock.GraphQL(`query RepositoryList\b`),
501 httpmock.GraphQLQuery(`{"data":{"repositoryOwner":{"login":"octocat","repositories":{"totalCount":0}}}}`,
502 func(query string, params map[string]interface{}) {
503 assert.False(t, strings.Contains(query, "visibility"))
504 },
505 ),
506 )
507
508 opts := ListOptions{
509 IO: ios,
510 HttpClient: func() (*http.Client, error) {
511 return &http.Client{Transport: reg}, nil
512 },
513 Config: func() (gh.Config, error) {
514 return config.NewBlankConfig(), nil
515 },
516 Now: func() time.Time {
517 t, _ := time.Parse(time.RFC822, "19 Feb 21 15:00 UTC")
518 return t
519 },
520 Limit: 30,
521 Detector: &fd.DisabledDetectorMock{},
522 }
523
524 err := listRun(&opts)
525
526 assert.NoError(t, err)
527 assert.Equal(t, "", stderr.String())
528 assert.Equal(t, "", stdout.String())
529}
530
531func TestRepoList_invalidOwner(t *testing.T) {
532 ios, _, stdout, stderr := iostreams.Test()

Callers

nothing calls this directly

Calls 13

VerifyMethod · 0.95
RegisterMethod · 0.95
TestFunction · 0.92
GraphQLFunction · 0.92
GraphQLQueryFunction · 0.92
NewBlankConfigFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
ContainsMethod · 0.80
EqualMethod · 0.80
listRunFunction · 0.70

Tested by

no test coverage detected