MCPcopy
hub / github.com/cli/cli / TestRunMarkTemplate_Org

Function TestRunMarkTemplate_Org

pkg/cmd/project/mark-template/mark_template_test.go:92–182  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestRunMarkTemplate_Org(t *testing.T) {
93 defer gock.Off()
94 gock.Observe(gock.DumpRequest)
95
96 // get org ID
97 gock.New("https://api.github.com").
98 Post("/graphql").
99 MatchType("json").
100 JSON(map[string]interface{}{
101 "query": "query UserOrgOwner.*",
102 "variables": map[string]interface{}{
103 "login": "github",
104 },
105 }).
106 Reply(200).
107 JSON(map[string]interface{}{
108 "data": map[string]interface{}{
109 "organization": map[string]interface{}{
110 "id": "an ID",
111 },
112 },
113 "errors": []interface{}{
114 map[string]interface{}{
115 "type": "NOT_FOUND",
116 "path": []string{"user"},
117 },
118 },
119 })
120
121 // get project ID
122 gock.New("https://api.github.com").
123 Post("/graphql").
124 MatchType("json").
125 JSON(map[string]interface{}{
126 "query": "query OrgProject.*",
127 "variables": map[string]interface{}{
128 "login": "github",
129 "number": 1,
130 "firstItems": 0,
131 "afterItems": nil,
132 "firstFields": 0,
133 "afterFields": nil,
134 },
135 }).
136 Reply(200).
137 JSON(map[string]interface{}{
138 "data": map[string]interface{}{
139 "organization": map[string]interface{}{
140 "projectV2": map[string]interface{}{
141 "id": "an ID",
142 },
143 },
144 },
145 })
146
147 // template project
148 gock.New("https://api.github.com").
149 Post("/graphql").

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runMarkTemplateFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected