MCPcopy Index your code
hub / github.com/cli/cli / TestRunDelete_Me

Function TestRunDelete_Me

pkg/cmd/project/delete/delete_test.go:268–348  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

266}
267
268func TestRunDelete_Me(t *testing.T) {
269 defer gock.Off()
270 gock.Observe(gock.DumpRequest)
271
272 // get viewer ID
273 gock.New("https://api.github.com").
274 Post("/graphql").
275 MatchType("json").
276 JSON(map[string]interface{}{
277 "query": "query ViewerOwner.*",
278 }).
279 Reply(200).
280 JSON(map[string]interface{}{
281 "data": map[string]interface{}{
282 "viewer": map[string]interface{}{
283 "id": "an ID",
284 },
285 },
286 })
287
288 // get project ID
289 gock.New("https://api.github.com").
290 Post("/graphql").
291 MatchType("json").
292 JSON(map[string]interface{}{
293 "query": "query ViewerProject.*",
294 "variables": map[string]interface{}{
295 "number": 1,
296 "firstItems": 0,
297 "afterItems": nil,
298 "firstFields": 0,
299 "afterFields": nil,
300 },
301 }).
302 Reply(200).
303 JSON(map[string]interface{}{
304 "data": map[string]interface{}{
305 "viewer": map[string]interface{}{
306 "projectV2": map[string]interface{}{
307 "id": "an ID",
308 },
309 },
310 },
311 })
312
313 // delete project
314 gock.New("https://api.github.com").
315 Post("/graphql").
316 BodyString(`{"query":"mutation DeleteProject.*","variables":{"afterFields":null,"afterItems":null,"firstFields":0,"firstItems":0,"input":{"projectId":"an ID"}}}`).
317 Reply(200).
318 JSON(map[string]interface{}{
319 "data": map[string]interface{}{
320 "deleteProjectV2": map[string]interface{}{
321 "projectV2": map[string]interface{}{
322 "id": "project ID",
323 "number": 1,
324 },
325 },

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected