(t *testing.T)
| 165 | } |
| 166 | |
| 167 | func Test_ValidateInputCmd_Failure(t *testing.T) { |
| 168 | fs := afero.NewMemMapFs() |
| 169 | require.NoError(t, afero.WriteFile(fs, "/bad.yaml", []byte("invalid"), 0o644)) |
| 170 | |
| 171 | // Mock validator: returns an error |
| 172 | cmd, _ := setUpValidateInputCmd(mockValidate(nil, errors.New("validation failed")), fs) |
| 173 | cmd.SetArgs([]string{ |
| 174 | "input", |
| 175 | "--file", "/bad.yaml", |
| 176 | "--policy", `{"publicKey": "testkey"}`, |
| 177 | }) |
| 178 | |
| 179 | utils.SetTestRekorPublicKey(t) |
| 180 | err := cmd.Execute() |
| 181 | assert.Error(t, err) |
| 182 | assert.EqualError(t, err, "error validating file /bad.yaml: validation failed") |
| 183 | } |
| 184 | |
| 185 | func Test_ValidateInputCmd_StrictMode(t *testing.T) { |
| 186 | fs := afero.NewMemMapFs() |
nothing calls this directly
no test coverage detected