(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestMapCustomSubstrings(t *testing.T) { |
| 48 | oldSensitiveSubstrings := make([]string, len(GlobalSensitiveSubstrings)) |
| 49 | copy(oldSensitiveSubstrings, GlobalSensitiveSubstrings) |
| 50 | defer func() { |
| 51 | GlobalSensitiveSubstrings = oldSensitiveSubstrings |
| 52 | }() |
| 53 | |
| 54 | data := map[string]interface{}{"foo": "bar", "123": 456} |
| 55 | |
| 56 | require.Equal(t, map[string]interface{}{"foo": "bar", "123": 456}, Map(data)) |
| 57 | |
| 58 | AddSensitiveSubstring("Foo") |
| 59 | |
| 60 | require.Equal(t, map[string]interface{}{"foo": "[FILTERED]", "123": 456}, Map(data)) |
| 61 | |
| 62 | require.Equal(t, []string{ |
| 63 | "authorization", |
| 64 | "cookie", |
| 65 | "token", |
| 66 | "password", |
| 67 | "secret", |
| 68 | "foo", |
| 69 | }, GlobalSensitiveSubstrings) |
| 70 | } |
| 71 | |
| 72 | func TestHeaders(t *testing.T) { |
| 73 | testCases := []struct { |
nothing calls this directly
no test coverage detected