MCPcopy
hub / github.com/cli/cli / TestRunUpdate_User

Function TestRunUpdate_User

pkg/cmd/project/edit/edit_test.go:133–230  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestRunUpdate_User(t *testing.T) {
134 defer gock.Off()
135 gock.Observe(gock.DumpRequest)
136
137 // get user ID
138 gock.New("https://api.github.com").
139 Post("/graphql").
140 MatchType("json").
141 JSON(map[string]interface{}{
142 "query": "query UserOrgOwner.*",
143 "variables": map[string]interface{}{
144 "login": "monalisa",
145 },
146 }).
147 Reply(200).
148 JSON(map[string]interface{}{
149 "data": map[string]interface{}{
150 "user": map[string]interface{}{
151 "id": "an ID",
152 },
153 },
154 "errors": []interface{}{
155 map[string]interface{}{
156 "type": "NOT_FOUND",
157 "path": []string{"organization"},
158 },
159 },
160 })
161
162 // get user project ID
163 gock.New("https://api.github.com").
164 Post("/graphql").
165 MatchType("json").
166 JSON(map[string]interface{}{
167 "query": "query UserProject.*",
168 "variables": map[string]interface{}{
169 "login": "monalisa",
170 "number": 1,
171 "firstItems": 0,
172 "afterItems": nil,
173 "firstFields": 0,
174 "afterFields": nil,
175 },
176 }).
177 Reply(200).
178 JSON(map[string]interface{}{
179 "data": map[string]interface{}{
180 "user": map[string]interface{}{
181 "projectV2": map[string]string{
182 "id": "an ID",
183 },
184 },
185 },
186 })
187
188 // edit project
189 gock.New("https://api.github.com").
190 Post("/graphql").

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected