(t *testing.T)
| 256 | } |
| 257 | |
| 258 | func 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, |
nothing calls this directly
no test coverage detected