MCPcopy
hub / github.com/cli/cli / TestRunClose_Org

Function TestRunClose_Org

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

Source from the content-addressed store, hash-verified

185}
186
187func TestRunClose_Org(t *testing.T) {
188 defer gock.Off()
189 // gock.Observe(gock.DumpRequest)
190
191 // get org ID
192 gock.New("https://api.github.com").
193 Post("/graphql").
194 MatchType("json").
195 JSON(map[string]interface{}{
196 "query": "query UserOrgOwner.*",
197 "variables": map[string]interface{}{
198 "login": "github",
199 },
200 }).
201 Reply(200).
202 JSON(map[string]interface{}{
203 "data": map[string]interface{}{
204 "organization": map[string]interface{}{
205 "id": "an ID",
206 },
207 },
208 "errors": []interface{}{
209 map[string]interface{}{
210 "type": "NOT_FOUND",
211 "path": []string{"user"},
212 },
213 },
214 })
215
216 // get org project ID
217 gock.New("https://api.github.com").
218 Post("/graphql").
219 MatchType("json").
220 JSON(map[string]interface{}{
221 "query": "query OrgProject.*",
222 "variables": map[string]interface{}{
223 "login": "github",
224 "number": 1,
225 "firstItems": 0,
226 "afterItems": nil,
227 "firstFields": 0,
228 "afterFields": nil,
229 },
230 }).
231 Reply(200).
232 JSON(map[string]interface{}{
233 "data": map[string]interface{}{
234 "organization": map[string]interface{}{
235 "projectV2": map[string]string{
236 "id": "an ID",
237 },
238 },
239 },
240 })
241
242 // close project
243 gock.New("https://api.github.com").
244 Post("/graphql").

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected