| 177 | } |
| 178 | |
| 179 | func Test_PrintOutputsExpectedJSON(t *testing.T) { |
| 180 | // we don't care much about content as much as the JSON encoding is correct |
| 181 | outputs := Outputs{ |
| 182 | {}, |
| 183 | {}, |
| 184 | } |
| 185 | |
| 186 | var buff bytes.Buffer |
| 187 | |
| 188 | outputs.Print(&buff) |
| 189 | |
| 190 | assert.JSONEq(t, `[ |
| 191 | { |
| 192 | "imageSignatureCheck": { |
| 193 | "passed": false |
| 194 | }, |
| 195 | "imageAccessibleCheck": { |
| 196 | "passed": false |
| 197 | }, |
| 198 | "attestationSignatureCheck": { |
| 199 | "passed": false |
| 200 | }, |
| 201 | "attestationSyntaxCheck": { |
| 202 | "passed": false |
| 203 | }, |
| 204 | "policyCheck": null |
| 205 | }, |
| 206 | { |
| 207 | "imageSignatureCheck": { |
| 208 | "passed": false |
| 209 | }, |
| 210 | "imageAccessibleCheck": { |
| 211 | "passed": false |
| 212 | }, |
| 213 | "attestationSignatureCheck": { |
| 214 | "passed": false |
| 215 | }, |
| 216 | "attestationSyntaxCheck": { |
| 217 | "passed": false |
| 218 | }, |
| 219 | "policyCheck": null |
| 220 | } |
| 221 | ]`, buff.String()) |
| 222 | } |
| 223 | |
| 224 | func Test_Violations(t *testing.T) { |
| 225 | cases := []struct { |