MCPcopy
hub / github.com/cli/cli / Test_listRun

Function Test_listRun

pkg/cmd/config/list/list_test.go:73–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func Test_listRun(t *testing.T) {
74 tests := []struct {
75 name string
76 input *ListOptions
77 config gh.Config
78 stdout string
79 wantErr bool
80 }{
81 {
82 name: "list",
83 config: func() gh.Config {
84 cfg := config.NewBlankConfig()
85 cfg.Set("HOST", "git_protocol", "ssh")
86 cfg.Set("HOST", "editor", "/usr/bin/vim")
87 cfg.Set("HOST", "prompt", "disabled")
88 cfg.Set("HOST", "prefer_editor_prompt", "enabled")
89 cfg.Set("HOST", "pager", "less")
90 cfg.Set("HOST", "http_unix_socket", "")
91 cfg.Set("HOST", "browser", "brave")
92 return cfg
93 }(),
94 input: &ListOptions{Hostname: "HOST"},
95 stdout: heredoc.Doc(`
96 git_protocol=ssh
97 editor=/usr/bin/vim
98 prompt=disabled
99 prefer_editor_prompt=enabled
100 pager=less
101 http_unix_socket=
102 browser=brave
103 color_labels=disabled
104 accessible_colors=disabled
105 accessible_prompter=disabled
106 spinner=enabled
107 telemetry=enabled
108 `),
109 },
110 }
111
112 for _, tt := range tests {
113 ios, _, stdout, _ := iostreams.Test()
114 tt.input.IO = ios
115 tt.input.Config = func() (gh.Config, error) {
116 return tt.config, nil
117 }
118
119 t.Run(tt.name, func(t *testing.T) {
120 err := listRun(tt.input)
121 require.NoError(t, err)
122 require.Equal(t, tt.stdout, stdout.String())
123 })
124 }
125}

Callers

nothing calls this directly

Calls 7

NewBlankConfigFunction · 0.92
TestFunction · 0.92
EqualMethod · 0.80
listRunFunction · 0.70
SetMethod · 0.65
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected