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

Function TestRunCopy_JSON

pkg/cmd/project/copy/copy_test.go:463–586  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected