MCPcopy
hub / github.com/cli/cli / TestRunListWeb_Org

Function TestRunListWeb_Org

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

Source from the content-addressed store, hash-verified

723}
724
725func TestRunListWeb_Org(t *testing.T) {
726 defer gock.Off()
727 gock.Observe(gock.DumpRequest)
728 // get org ID
729 gock.New("https://api.github.com").
730 Post("/graphql").
731 MatchType("json").
732 JSON(map[string]interface{}{
733 "query": "query UserOrgOwner.*",
734 "variables": map[string]interface{}{
735 "login": "github",
736 },
737 }).
738 Reply(200).
739 JSON(map[string]interface{}{
740 "data": map[string]interface{}{
741 "organization": map[string]interface{}{
742 "id": "an ID",
743 },
744 },
745 "errors": []interface{}{
746 map[string]interface{}{
747 "type": "NOT_FOUND",
748 "path": []string{"user"},
749 },
750 },
751 })
752
753 client := queries.NewTestClient()
754 buf := bytes.Buffer{}
755 config := listConfig{
756 opts: listOpts{
757 owner: "github",
758 web: true,
759 },
760 URLOpener: func(url string) error {
761 buf.WriteString(url)
762 return nil
763 },
764 client: client,
765 }
766
767 err := runList(config)
768 assert.NoError(t, err)
769 assert.Equal(t, "https://github.com/orgs/github/projects", buf.String())
770}
771
772func TestRunListWeb_Me(t *testing.T) {
773 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