MCPcopy
hub / github.com/cli/cli / TestRunListWeb_Empty

Function TestRunListWeb_Empty

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

Source from the content-addressed store, hash-verified

810}
811
812func TestRunListWeb_Empty(t *testing.T) {
813 defer gock.Off()
814 gock.Observe(gock.DumpRequest)
815
816 // get viewer ID
817 gock.New("https://api.github.com").
818 Post("/graphql").
819 MatchType("json").
820 JSON(map[string]interface{}{
821 "query": "query Viewer.*",
822 }).
823 Reply(200).
824 JSON(map[string]interface{}{
825 "data": map[string]interface{}{
826 "viewer": map[string]interface{}{
827 "id": "an ID",
828 "login": "theviewer",
829 },
830 },
831 })
832
833 client := queries.NewTestClient()
834 buf := bytes.Buffer{}
835 config := listConfig{
836 opts: listOpts{
837 web: true,
838 },
839 URLOpener: func(url string) error {
840 buf.WriteString(url)
841 return nil
842 },
843 client: client,
844 }
845
846 err := runList(config)
847 assert.NoError(t, err)
848 assert.Equal(t, "https://github.com/users/theviewer/projects", buf.String())
849}
850
851func TestRunListWeb_Closed(t *testing.T) {
852 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