(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func Test_listRun(t *testing.T) { |
| 83 | tests := []struct { |
| 84 | name string |
| 85 | tty bool |
| 86 | opts *ListOptions |
| 87 | jsonFields []string |
| 88 | wantOut []string |
| 89 | }{ |
| 90 | { |
| 91 | name: "repo tty", |
| 92 | tty: true, |
| 93 | opts: &ListOptions{}, |
| 94 | wantOut: []string{ |
| 95 | "NAME VALUE UPDATED", |
| 96 | "VARIABLE_ONE one about 34 years ago", |
| 97 | "VARIABLE_TWO two about 2 years ago", |
| 98 | "VARIABLE_THREE three about 47 years ago", |
| 99 | }, |
| 100 | }, |
| 101 | { |
| 102 | name: "repo not tty", |
| 103 | tty: false, |
| 104 | opts: &ListOptions{}, |
| 105 | wantOut: []string{ |
| 106 | "VARIABLE_ONE\tone\t1988-10-11T00:00:00Z", |
| 107 | "VARIABLE_TWO\ttwo\t2020-12-04T00:00:00Z", |
| 108 | "VARIABLE_THREE\tthree\t1975-11-30T00:00:00Z", |
| 109 | }, |
| 110 | }, |
| 111 | { |
| 112 | name: "repo not tty, json", |
| 113 | tty: false, |
| 114 | opts: &ListOptions{}, |
| 115 | jsonFields: []string{"name", "value"}, |
| 116 | wantOut: []string{`[ |
| 117 | {"name":"VARIABLE_ONE","value":"one"}, |
| 118 | {"name":"VARIABLE_TWO","value":"two"}, |
| 119 | {"name":"VARIABLE_THREE","value":"three"} |
| 120 | ]`}, |
| 121 | }, |
| 122 | { |
| 123 | name: "org tty", |
| 124 | tty: true, |
| 125 | opts: &ListOptions{ |
| 126 | OrgName: "UmbrellaCorporation", |
| 127 | }, |
| 128 | wantOut: []string{ |
| 129 | "NAME VALUE UPDATED VISIBILITY", |
| 130 | "VARIABLE_ONE org_one about 34 years ago Visible to all repositories", |
| 131 | "VARIABLE_TWO org_two about 2 years ago Visible to private repositories", |
| 132 | "VARIABLE_THREE org_three about 47 years ago Visible to 2 selected reposito...", |
| 133 | }, |
| 134 | }, |
| 135 | { |
| 136 | name: "org not tty", |
| 137 | tty: false, |
| 138 | opts: &ListOptions{ |
| 139 | OrgName: "UmbrellaCorporation", |
nothing calls this directly
no test coverage detected