(t *testing.T)
| 529 | } |
| 530 | |
| 531 | func 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 | } |
nothing calls this directly
no test coverage detected