MCPcopy
hub / github.com/cli/cli / TestRunListWeb_Me

Function TestRunListWeb_Me

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

Source from the content-addressed store, hash-verified

770}
771
772func TestRunListWeb_Me(t *testing.T) {
773 defer gock.Off()
774 gock.Observe(gock.DumpRequest)
775
776 // get viewer ID
777 gock.New("https://api.github.com").
778 Post("/graphql").
779 MatchType("json").
780 JSON(map[string]interface{}{
781 "query": "query Viewer.*",
782 }).
783 Reply(200).
784 JSON(map[string]interface{}{
785 "data": map[string]interface{}{
786 "viewer": map[string]interface{}{
787 "id": "an ID",
788 "login": "theviewer",
789 },
790 },
791 })
792
793 client := queries.NewTestClient()
794 buf := bytes.Buffer{}
795 config := listConfig{
796 opts: listOpts{
797 owner: "@me",
798 web: true,
799 },
800 URLOpener: func(url string) error {
801 buf.WriteString(url)
802 return nil
803 },
804 client: client,
805 }
806
807 err := runList(config)
808 assert.NoError(t, err)
809 assert.Equal(t, "https://github.com/users/theviewer/projects", buf.String())
810}
811
812func TestRunListWeb_Empty(t *testing.T) {
813 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