Skip to content

Commit

Permalink
handlers/email: Add TestBadEnabled to email tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Madouura committed Jun 27, 2018
1 parent 54e8146 commit d79ea53
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions handlers/email/email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -82,7 +81,6 @@ func handleClient(c *Client, closePrematurly bool) string {
}

func TestEmailHandler(t *testing.T) {

tests := []struct {
expected string
}{
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d79ea53

Please sign in to comment.