MCPcopy
hub / github.com/cli/cli / TestRunList_User_tty

Function TestRunList_User_tty

pkg/cmd/project/item-list/item_list_test.go:102–210  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestRunList_User_tty(t *testing.T) {
103 defer gock.Off()
104 // gock.Observe(gock.DumpRequest)
105
106 // get user ID
107 gock.New("https://api.github.com").
108 Post("/graphql").
109 MatchType("json").
110 JSON(map[string]interface{}{
111 "query": "query UserOrgOwner.*",
112 "variables": map[string]interface{}{
113 "login": "monalisa",
114 },
115 }).
116 Reply(200).
117 JSON(map[string]interface{}{
118 "data": map[string]interface{}{
119 "user": map[string]interface{}{
120 "id": "an ID",
121 },
122 },
123 "errors": []interface{}{
124 map[string]interface{}{
125 "type": "NOT_FOUND",
126 "path": []string{"organization"},
127 },
128 },
129 })
130
131 // list project items
132 gock.New("https://api.github.com").
133 Post("/graphql").
134 JSON(map[string]interface{}{
135 "query": "query UserProjectWithItems.*",
136 "variables": map[string]interface{}{
137 "firstItems": queries.LimitDefault,
138 "afterItems": nil,
139 "firstFields": queries.LimitMax,
140 "afterFields": nil,
141 "login": "monalisa",
142 "number": 1,
143 },
144 }).
145 Reply(200).
146 JSON(map[string]interface{}{
147 "data": map[string]interface{}{
148 "user": map[string]interface{}{
149 "projectV2": map[string]interface{}{
150 "items": map[string]interface{}{
151 "nodes": []map[string]interface{}{
152 {
153 "id": "issue ID",
154 "content": map[string]interface{}{
155 "__typename": "Issue",
156 "title": "an issue",
157 "number": 1,
158 "repository": map[string]string{
159 "nameWithOwner": "cli/go-gh",

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected