MCPcopy Create free account
hub / github.com/cli/cli / Test_listRun

Function Test_listRun

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

Source from the content-addressed store, hash-verified

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