MCPcopy
hub / github.com/cli/cli / TestRunClose_JSON

Function TestRunClose_JSON

pkg/cmd/project/close/close_test.go:456–551  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

454}
455
456func TestRunClose_JSON(t *testing.T) {
457 defer gock.Off()
458 // gock.Observe(gock.DumpRequest)
459
460 // get user ID
461 gock.New("https://api.github.com").
462 Post("/graphql").
463 MatchType("json").
464 JSON(map[string]interface{}{
465 "query": "query UserOrgOwner.*",
466 "variables": map[string]interface{}{
467 "login": "monalisa",
468 },
469 }).
470 Reply(200).
471 JSON(map[string]interface{}{
472 "data": map[string]interface{}{
473 "user": map[string]interface{}{
474 "id": "an ID",
475 },
476 },
477 "errors": []interface{}{
478 map[string]interface{}{
479 "type": "NOT_FOUND",
480 "path": []string{"organization"},
481 },
482 },
483 })
484
485 // get user project ID
486 gock.New("https://api.github.com").
487 Post("/graphql").
488 MatchType("json").
489 JSON(map[string]interface{}{
490 "query": "query UserProject.*",
491 "variables": map[string]interface{}{
492 "login": "monalisa",
493 "number": 1,
494 "firstItems": 0,
495 "afterItems": nil,
496 "firstFields": 0,
497 "afterFields": nil,
498 },
499 }).
500 Reply(200).
501 JSON(map[string]interface{}{
502 "data": map[string]interface{}{
503 "user": map[string]interface{}{
504 "projectV2": map[string]string{
505 "id": "an ID",
506 },
507 },
508 },
509 })
510
511 // close project
512 gock.New("https://api.github.com").
513 Post("/graphql").

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected