MCPcopy
hub / github.com/cli/cli / TestRunViewWeb_TTY

Function TestRunViewWeb_TTY

pkg/cmd/project/view/view_test.go:532–749  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

530}
531
532func TestRunViewWeb_TTY(t *testing.T) {
533 tests := []struct {
534 name string
535 setup func(*viewOpts, *testing.T) func()
536 promptStubs func(*prompter.PrompterMock)
537 gqlStubs func(*testing.T)
538 expectedBrowse string
539 tty bool
540 }{
541 {
542 name: "Org project --web with tty",
543 tty: true,
544 setup: func(vo *viewOpts, t *testing.T) func() {
545 return func() {
546 vo.web = true
547 }
548 },
549 gqlStubs: func(t *testing.T) {
550 gock.New("https://api.github.com").
551 Post("/graphql").
552 MatchType("json").
553 JSON(map[string]interface{}{
554 "query": "query ViewerLoginAndOrgs.*",
555 "variables": map[string]interface{}{
556 "after": nil,
557 },
558 }).
559 Reply(200).
560 JSON(map[string]interface{}{
561 "data": map[string]interface{}{
562 "viewer": map[string]interface{}{
563 "id": "monalisa-ID",
564 "login": "monalisa",
565 "organizations": map[string]interface{}{
566 "nodes": []interface{}{
567 map[string]interface{}{
568 "login": "github",
569 "viewerCanCreateProjects": true,
570 },
571 },
572 },
573 },
574 },
575 })
576
577 gock.New("https://api.github.com").
578 Post("/graphql").
579 MatchType("json").
580 JSON(map[string]interface{}{
581 "query": "query OrgProjects.*",
582 "variables": map[string]interface{}{
583 "after": nil,
584 "afterFields": nil,
585 "afterItems": nil,
586 "first": 30,
587 "firstFields": 100,
588 "firstItems": 0,
589 "login": "github",

Callers

nothing calls this directly

Calls 13

IndexForFunction · 0.92
NoSuchPromptErrFunction · 0.92
TestFunction · 0.92
NewTestClientFunction · 0.92
WithPrompterFunction · 0.92
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
runViewFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected