MCPcopy
hub / github.com/cli/cli / TestRunListOrg

Function TestRunListOrg

pkg/cmd/project/list/list_test.go:470–547  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

468}
469
470func TestRunListOrg(t *testing.T) {
471 defer gock.Off()
472 gock.Observe(gock.DumpRequest)
473
474 // get org ID
475 gock.New("https://api.github.com").
476 Post("/graphql").
477 MatchType("json").
478 JSON(map[string]interface{}{
479 "query": "query UserOrgOwner.*",
480 "variables": map[string]interface{}{
481 "login": "github",
482 },
483 }).
484 Reply(200).
485 JSON(map[string]interface{}{
486 "data": map[string]interface{}{
487 "organization": map[string]interface{}{
488 "id": "an ID",
489 },
490 },
491 "errors": []interface{}{
492 map[string]interface{}{
493 "type": "NOT_FOUND",
494 "path": []string{"user"},
495 },
496 },
497 })
498
499 gock.New("https://api.github.com").
500 Post("/graphql").
501 Reply(200).
502 JSON(map[string]interface{}{
503 "data": map[string]interface{}{
504 "organization": map[string]interface{}{
505 "login": "monalisa",
506 "projectsV2": map[string]interface{}{
507 "nodes": []interface{}{
508 map[string]interface{}{
509 "title": "Project 1",
510 "shortDescription": "Short description 1",
511 "url": "url1",
512 "closed": false,
513 "ID": "id-1",
514 "number": 1,
515 },
516 map[string]interface{}{
517 "title": "Project 2",
518 "shortDescription": "",
519 "url": "url2",
520 "closed": true,
521 "ID": "id-2",
522 "number": 2,
523 },
524 },
525 },
526 },
527 },

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected