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

Function TestRunDelete_JSON

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

Source from the content-addressed store, hash-verified

358}
359
360func TestRunDelete_JSON(t *testing.T) {
361 defer gock.Off()
362 gock.Observe(gock.DumpRequest)
363 // get user ID
364 gock.New("https://api.github.com").
365 Post("/graphql").
366 MatchType("json").
367 JSON(map[string]interface{}{
368 "query": "query UserOrgOwner.*",
369 "variables": map[string]interface{}{
370 "login": "monalisa",
371 },
372 }).
373 Reply(200).
374 JSON(map[string]interface{}{
375 "data": map[string]interface{}{
376 "user": map[string]interface{}{
377 "id": "an ID",
378 },
379 },
380 "errors": []interface{}{
381 map[string]interface{}{
382 "type": "NOT_FOUND",
383 "path": []string{"organization"},
384 },
385 },
386 })
387
388 // get project ID
389 gock.New("https://api.github.com").
390 Post("/graphql").
391 MatchType("json").
392 JSON(map[string]interface{}{
393 "query": "query UserProject.*",
394 "variables": map[string]interface{}{
395 "login": "monalisa",
396 "number": 1,
397 "firstItems": 0,
398 "afterItems": nil,
399 "firstFields": 0,
400 "afterFields": nil,
401 },
402 }).
403 Reply(200).
404 JSON(map[string]interface{}{
405 "data": map[string]interface{}{
406 "user": map[string]interface{}{
407 "projectV2": map[string]interface{}{
408 "id": "an ID",
409 },
410 },
411 },
412 })
413
414 // delete item
415 gock.New("https://api.github.com").
416 Post("/graphql").
417 BodyString(`{"query":"mutation DeleteProjectItem.*","variables":{"input":{"projectId":"an ID","itemId":"item ID"}}}`).

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
NewJSONExporterFunction · 0.92
runDeleteItemFunction · 0.85
ReplyMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected