diff --git a/handlers/email/email_test.go b/handlers/email/email_test.go index 13add72..2b9e94c 100644 --- a/handlers/email/email_test.go +++ b/handlers/email/email_test.go @@ -45,7 +45,6 @@ func (c *Client) r() string { } func handleClient(c *Client, closePrematurly bool) string { - var msg []byte c.w("220 Welcome to the Jungle") @@ -82,7 +81,6 @@ func handleClient(c *Client, closePrematurly bool) string { } func TestEmailHandler(t *testing.T) { - tests := []struct { expected string }{ @@ -104,7 +102,6 @@ func TestEmailHandler(t *testing.T) { email.SetTimestampFormat("MST") email.SetTemplate(defaultTemplate) email.SetEmailConfig("localhost", 3041, "", "", "from@email.com", []string{"to@email.com"}) - email.SetEnabled(true) // email.SetFormatFunc(testFormatFunc) log.AddHandler(email, log.InfoLevel, log.DebugLevel) @@ -211,6 +208,18 @@ func TestBadSend(t *testing.T) { log.Info("info") } +func TestBadEnabled(t *testing.T) { + email := New("localhost", 3041, "", "", "from@email.com", []string{"to@email.com"}) + email.SetEnabled(false) + log.AddHandler(email, log.InfoLevel) + + if email.enabled { + t.Errorf("Expected 'false' Got 'true'") + } + + log.Info("info") +} + func testFormatFunc(email *Email) Formatter { var err error b := new(bytes.Buffer)