mirror of
https://github.com/kyverno/policy-reporter.git
synced 2024-12-14 11:57:32 +00:00
f3b980bfd3
* Implement MetadataClient Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
37 lines
1,019 B
Go
37 lines
1,019 B
Go
package email_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
mail "github.com/xhit/go-simple-mail/v2"
|
|
|
|
"github.com/kyverno/policy-reporter/pkg/email"
|
|
)
|
|
|
|
func Test_EncryptionFromString(t *testing.T) {
|
|
t.Run("EncryptionFromString.SSLTLS", func(t *testing.T) {
|
|
encryption := email.EncryptionFromString("ssl/tls")
|
|
if encryption != mail.EncryptionSSLTLS {
|
|
t.Errorf("Unexpected encryption mapping: %d", encryption)
|
|
}
|
|
})
|
|
t.Run("EncryptionFromString.STARTTLS", func(t *testing.T) {
|
|
encryption := email.EncryptionFromString("starttls")
|
|
if encryption != mail.EncryptionSTARTTLS {
|
|
t.Errorf("Unexpected encryption mapping: %d", encryption)
|
|
}
|
|
})
|
|
t.Run("EncryptionFromString.Default", func(t *testing.T) {
|
|
encryption := email.EncryptionFromString("")
|
|
if encryption != mail.EncryptionNone {
|
|
t.Errorf("Unexpected encryption mapping: %d", encryption)
|
|
}
|
|
})
|
|
}
|
|
|
|
func Test_NewClient(t *testing.T) {
|
|
client := email.NewClient("policy-reporter@kyverno.io", nil)
|
|
if client == nil {
|
|
t.Errorf("Unexpected client result")
|
|
}
|
|
}
|