(t *testing.T)
| 137 | } |
| 138 | |
| 139 | func 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 | { |
nothing calls this directly
no test coverage detected