MCPcopy
hub / github.com/cli/cli / TestRunDelete_Org

Function TestRunDelete_Org

pkg/cmd/project/item-delete/item_delete_test.go:192–279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestRunDelete_Org(t *testing.T) {
193 defer gock.Off()
194 gock.Observe(gock.DumpRequest)
195 // get org ID
196 gock.New("https://api.github.com").
197 Post("/graphql").
198 MatchType("json").
199 JSON(map[string]interface{}{
200 "query": "query UserOrgOwner.*",
201 "variables": map[string]interface{}{
202 "login": "github",
203 },
204 }).
205 Reply(200).
206 JSON(map[string]interface{}{
207 "data": map[string]interface{}{
208 "organization": map[string]interface{}{
209 "id": "an ID",
210 },
211 },
212 "errors": []interface{}{
213 map[string]interface{}{
214 "type": "NOT_FOUND",
215 "path": []string{"user"},
216 },
217 },
218 })
219
220 // get project ID
221 gock.New("https://api.github.com").
222 Post("/graphql").
223 MatchType("json").
224 JSON(map[string]interface{}{
225 "query": "query OrgProject.*",
226 "variables": map[string]interface{}{
227 "login": "github",
228 "number": 1,
229 "firstItems": 0,
230 "afterItems": nil,
231 "firstFields": 0,
232 "afterFields": nil,
233 },
234 }).
235 Reply(200).
236 JSON(map[string]interface{}{
237 "data": map[string]interface{}{
238 "organization": map[string]interface{}{
239 "projectV2": map[string]interface{}{
240 "id": "an ID",
241 },
242 },
243 },
244 })
245
246 // delete item
247 gock.New("https://api.github.com").
248 Post("/graphql").
249 BodyString(`{"query":"mutation DeleteProjectItem.*","variables":{"input":{"projectId":"an ID","itemId":"item ID"}}}`).

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runDeleteItemFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected