MCPcopy
hub / github.com/cli/cli / TestRunCreateField_JSON

Function TestRunCreateField_JSON

pkg/cmd/project/field-create/field_create_test.go:633–726  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

631}
632
633func TestRunCreateField_JSON(t *testing.T) {
634 defer gock.Off()
635 gock.Observe(gock.DumpRequest)
636
637 // get user ID
638 gock.New("https://api.github.com").
639 Post("/graphql").
640 MatchType("json").
641 JSON(map[string]interface{}{
642 "query": "query UserOrgOwner.*",
643 "variables": map[string]interface{}{
644 "login": "monalisa",
645 },
646 }).
647 Reply(200).
648 JSON(map[string]interface{}{
649 "data": map[string]interface{}{
650 "user": map[string]interface{}{
651 "id": "an ID",
652 },
653 },
654 "errors": []interface{}{
655 map[string]interface{}{
656 "type": "NOT_FOUND",
657 "path": []string{"organization"},
658 },
659 },
660 })
661
662 // get project ID
663 gock.New("https://api.github.com").
664 Post("/graphql").
665 MatchType("json").
666 JSON(map[string]interface{}{
667 "query": "query UserProject.*",
668 "variables": map[string]interface{}{
669 "login": "monalisa",
670 "number": 1,
671 "firstItems": 0,
672 "afterItems": nil,
673 "firstFields": 0,
674 "afterFields": nil,
675 },
676 }).
677 Reply(200).
678 JSON(map[string]interface{}{
679 "data": map[string]interface{}{
680 "user": map[string]interface{}{
681 "projectV2": map[string]interface{}{
682 "id": "an ID",
683 },
684 },
685 },
686 })
687
688 // create Field
689 gock.New("https://api.github.com").
690 Post("/graphql").

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected