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

Function Test_listRun

pkg/cmd/ruleset/list/list_test.go:139–342  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func Test_listRun(t *testing.T) {
140 tests := []struct {
141 name string
142 isTTY bool
143 opts ListOptions
144 httpStubs func(*httpmock.Registry)
145 wantErr string
146 wantStdout string
147 wantStderr string
148 wantBrowse string
149 }{
150 {
151 name: "list repo rulesets",
152 isTTY: true,
153 wantStdout: heredoc.Doc(`
154
155 Showing 3 of 3 rulesets in OWNER/REPO
156
157 ID NAME SOURCE STATUS RULES
158 4 test OWNER/REPO (repo) evaluate 1
159 42 asdf OWNER/REPO (repo) active 2
160 77 foobar Org-Name (org) disabled 4
161 `),
162 httpStubs: func(reg *httpmock.Registry) {
163 reg.Register(
164 httpmock.GraphQL(`query RepoRulesetList\b`),
165 httpmock.FileResponse("./fixtures/rulesetList.json"),
166 )
167 },
168 wantStderr: "",
169 wantBrowse: "",
170 },
171 {
172 name: "list org rulesets",
173 isTTY: true,
174 opts: ListOptions{
175 IncludeParents: true,
176 Organization: "my-org",
177 },
178 wantStdout: heredoc.Doc(`
179
180 Showing 3 of 3 rulesets in my-org and its parents
181
182 ID NAME SOURCE STATUS RULES
183 4 test OWNER/REPO (repo) evaluate 1
184 42 asdf OWNER/REPO (repo) active 2
185 77 foobar Org-Name (org) disabled 4
186 `),
187 httpStubs: func(reg *httpmock.Registry) {
188 reg.Register(
189 httpmock.GraphQL(`query OrgRulesetList\b`),
190 httpmock.FileResponse("./fixtures/rulesetList.json"),
191 )
192 },
193 wantStderr: "",
194 wantBrowse: "",
195 },
196 {

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
VerifyMethod · 0.95
VerifyMethod · 0.95
GraphQLFunction · 0.92
FileResponseFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
FromFullNameFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected