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

Function TestRunMarkTemplate_JSON

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

Source from the content-addressed store, hash-verified

275}
276
277func TestRunMarkTemplate_JSON(t *testing.T) {
278 defer gock.Off()
279 gock.Observe(gock.DumpRequest)
280
281 // get org ID
282 gock.New("https://api.github.com").
283 Post("/graphql").
284 MatchType("json").
285 JSON(map[string]interface{}{
286 "query": "query UserOrgOwner.*",
287 "variables": map[string]interface{}{
288 "login": "github",
289 },
290 }).
291 Reply(200).
292 JSON(map[string]interface{}{
293 "data": map[string]interface{}{
294 "organization": map[string]interface{}{
295 "id": "an ID",
296 },
297 },
298 "errors": []interface{}{
299 map[string]interface{}{
300 "type": "NOT_FOUND",
301 "path": []string{"user"},
302 },
303 },
304 })
305
306 // get project ID
307 gock.New("https://api.github.com").
308 Post("/graphql").
309 MatchType("json").
310 JSON(map[string]interface{}{
311 "query": "query OrgProject.*",
312 "variables": map[string]interface{}{
313 "login": "github",
314 "number": 1,
315 "firstItems": 0,
316 "afterItems": nil,
317 "firstFields": 0,
318 "afterFields": nil,
319 },
320 }).
321 Reply(200).
322 JSON(map[string]interface{}{
323 "data": map[string]interface{}{
324 "organization": map[string]interface{}{
325 "projectV2": map[string]interface{}{
326 "id": "an ID",
327 },
328 },
329 },
330 })
331
332 // template project
333 gock.New("https://api.github.com").
334 Post("/graphql").

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected