(t *testing.T)
| 264 | } |
| 265 | |
| 266 | func TestLoadSystemDefaultPolicy_ErrorFile(t *testing.T) { |
| 267 | // Test that LoadSystemDefaultPolicy returns an error when the file is |
| 268 | // invalid |
| 269 | t.Parallel() |
| 270 | |
| 271 | mockUserLookup := &MockUserLookup{User: ValidUser} |
| 272 | policyLoader := NewTestSystemPolicyLoader(afero.NewMemMapFs(), mockUserLookup) |
| 273 | mockFs := policyLoader.FileLoader.Fs |
| 274 | // Create policy file at default path with invalid file |
| 275 | err := afero.WriteFile(mockFs, policy.SystemDefaultPolicyPath, []byte("{"), 0640) |
| 276 | require.NoError(t, err) |
| 277 | policy, _, err := policyLoader.LoadSystemPolicy() |
| 278 | require.NoError(t, err) |
| 279 | require.False(t, files.ConfigProblems().NoProblems()) |
| 280 | files.ConfigProblems().Clear() |
| 281 | |
| 282 | require.NotNil(t, policy, "should return policy even if problems encountered") |
| 283 | } |
| 284 | |
| 285 | func TestLoadSystemDefaultPolicy_Success(t *testing.T) { |
| 286 | // Test that LoadSystemDefaultPolicy returns the policy when there are no |
nothing calls this directly
no test coverage detected