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

Function Test_listRun

pkg/cmd/secret/list/list_test.go:257–650  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

255}
256
257func Test_listRun(t *testing.T) {
258 tests := []struct {
259 name string
260 tty bool
261 json bool
262 opts *ListOptions
263 wantOut []string
264 }{
265 {
266 name: "repo tty",
267 tty: true,
268 opts: &ListOptions{},
269 wantOut: []string{
270 "NAME UPDATED",
271 "SECRET_ONE about 34 years ago",
272 "SECRET_TWO about 2 years ago",
273 "SECRET_THREE about 47 years ago",
274 },
275 },
276 {
277 name: "repo not tty",
278 tty: false,
279 opts: &ListOptions{},
280 wantOut: []string{
281 "SECRET_ONE\t1988-10-11T00:00:00Z",
282 "SECRET_TWO\t2020-12-04T00:00:00Z",
283 "SECRET_THREE\t1975-11-30T00:00:00Z",
284 },
285 },
286 {
287 name: "org tty",
288 tty: true,
289 opts: &ListOptions{
290 OrgName: "UmbrellaCorporation",
291 },
292 wantOut: []string{
293 "NAME UPDATED VISIBILITY",
294 "SECRET_ONE about 34 years ago Visible to all repositories",
295 "SECRET_TWO about 2 years ago Visible to private repositories",
296 "SECRET_THREE about 47 years ago Visible to 2 selected repositories",
297 },
298 },
299 {
300 name: "org not tty",
301 tty: false,
302 opts: &ListOptions{
303 OrgName: "UmbrellaCorporation",
304 },
305 wantOut: []string{
306 "SECRET_ONE\t1988-10-11T00:00:00Z\tALL",
307 "SECRET_TWO\t2020-12-04T00:00:00Z\tPRIVATE",
308 "SECRET_THREE\t1975-11-30T00:00:00Z\tSELECTED",
309 },
310 },
311 {
312 name: "org tty, json",
313 tty: true,
314 json: true,

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
FromFullNameFunction · 0.92
NewBlankConfigFunction · 0.92
NewJSONExporterFunction · 0.92
ReplaceMethod · 0.80
SetStdoutTTYMethod · 0.80
SetFieldsMethod · 0.80
JoinMethod · 0.80

Tested by

no test coverage detected