finding_test.go 431 B

123456789101112131415161718192021222324252627
  1. package report
  2. import "testing"
  3. func TestRedact(t *testing.T) {
  4. tests := []struct {
  5. findings []Finding
  6. redact bool
  7. }{
  8. {
  9. redact: true,
  10. findings: []Finding{
  11. {
  12. Secret: "line containing secret",
  13. Match: "secret",
  14. },
  15. }},
  16. }
  17. for _, test := range tests {
  18. for _, f := range test.findings {
  19. f.Redact()
  20. if f.Secret != "REDACTED" {
  21. t.Error("redact not redacting: ", f.Secret)
  22. }
  23. }
  24. }
  25. }