MCPcopy
hub / github.com/cli/cli / TestRunClose_Reopen

Function TestRunClose_Reopen

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

Source from the content-addressed store, hash-verified

357}
358
359func TestRunClose_Reopen(t *testing.T) {
360 defer gock.Off()
361 // gock.Observe(gock.DumpRequest)
362
363 // get user ID
364 gock.New("https://api.github.com").
365 Post("/graphql").
366 MatchType("json").
367 JSON(map[string]interface{}{
368 "query": "query UserOrgOwner.*",
369 "variables": map[string]interface{}{
370 "login": "monalisa",
371 },
372 }).
373 Reply(200).
374 JSON(map[string]interface{}{
375 "data": map[string]interface{}{
376 "user": map[string]interface{}{
377 "id": "an ID",
378 },
379 },
380 "errors": []interface{}{
381 map[string]interface{}{
382 "type": "NOT_FOUND",
383 "path": []string{"organization"},
384 },
385 },
386 })
387
388 // get user project ID
389 gock.New("https://api.github.com").
390 Post("/graphql").
391 MatchType("json").
392 JSON(map[string]interface{}{
393 "query": "query UserProject.*",
394 "variables": map[string]interface{}{
395 "login": "monalisa",
396 "number": 1,
397 "firstItems": 0,
398 "afterItems": nil,
399 "firstFields": 0,
400 "afterFields": nil,
401 },
402 }).
403 Reply(200).
404 JSON(map[string]interface{}{
405 "data": map[string]interface{}{
406 "user": map[string]interface{}{
407 "projectV2": map[string]string{
408 "id": "an ID",
409 },
410 },
411 },
412 })
413
414 // close project
415 gock.New("https://api.github.com").
416 Post("/graphql").

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected