1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-14 11:57:32 +00:00
policy-reporter/pkg/email/functions_test.go
Frank Jogeleit 4c50043c88 Update Dependencies
Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
2022-12-04 15:02:16 +01:00

41 lines
1.1 KiB
Go

package email_test
import (
"testing"
"github.com/kyverno/policy-reporter/pkg/crd/api/policyreport/v1alpha2"
"github.com/kyverno/policy-reporter/pkg/email"
)
func Test_ColorFromStatus(t *testing.T) {
t.Run("ColorFromStatus.Pass", func(t *testing.T) {
color := email.ColorFromStatus(v1alpha2.StatusPass)
if color != email.PassColor {
t.Errorf("Unexpected pass color: %s", color)
}
})
t.Run("ColorFromStatus.Warn", func(t *testing.T) {
color := email.ColorFromStatus(v1alpha2.StatusWarn)
if color != email.WarnColor {
t.Errorf("Unexpected warn color: %s", color)
}
})
t.Run("ColorFromStatus.Fail", func(t *testing.T) {
color := email.ColorFromStatus(v1alpha2.StatusFail)
if color != email.FailColor {
t.Errorf("Unexpected fail color: %s", color)
}
})
t.Run("ColorFromStatus.Error", func(t *testing.T) {
color := email.ColorFromStatus(v1alpha2.StatusError)
if color != email.ErrorColor {
t.Errorf("Unexpected error color: %s", color)
}
})
t.Run("ColorFromStatus.Default", func(t *testing.T) {
color := email.ColorFromStatus("")
if color != email.DefaultColor {
t.Errorf("Unexpected error color: %s", color)
}
})
}