MCPcopy
hub / github.com/cli/cli / TestRunListWeb_User

Function TestRunListWeb_User

pkg/cmd/project/list/list_test.go:678–723  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

676}
677
678func TestRunListWeb_User(t *testing.T) {
679 defer gock.Off()
680 gock.Observe(gock.DumpRequest)
681 // get user ID
682 gock.New("https://api.github.com").
683 Post("/graphql").
684 MatchType("json").
685 JSON(map[string]interface{}{
686 "query": "query UserOrgOwner.*",
687 "variables": map[string]interface{}{
688 "login": "monalisa",
689 },
690 }).
691 Reply(200).
692 JSON(map[string]interface{}{
693 "data": map[string]interface{}{
694 "user": map[string]interface{}{
695 "id": "an ID",
696 },
697 },
698 "errors": []interface{}{
699 map[string]interface{}{
700 "type": "NOT_FOUND",
701 "path": []string{"organization"},
702 },
703 },
704 })
705
706 client := queries.NewTestClient()
707 buf := bytes.Buffer{}
708 config := listConfig{
709 opts: listOpts{
710 owner: "monalisa",
711 web: true,
712 },
713 URLOpener: func(url string) error {
714 buf.WriteString(url)
715 return nil
716 },
717 client: client,
718 }
719
720 err := runList(config)
721 assert.NoError(t, err)
722 assert.Equal(t, "https://github.com/users/monalisa/projects", buf.String())
723}
724
725func TestRunListWeb_Org(t *testing.T) {
726 defer gock.Off()

Callers

nothing calls this directly

Calls 5

NewTestClientFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected