Skip to content

Commit d79ea53

Browse files
committed
handlers/email: Add TestBadEnabled to email tests
1 parent 54e8146 commit d79ea53

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

handlers/email/email_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func (c *Client) r() string {
4545
}
4646

4747
func handleClient(c *Client, closePrematurly bool) string {
48-
4948
var msg []byte
5049

5150
c.w("220 Welcome to the Jungle")
@@ -82,7 +81,6 @@ func handleClient(c *Client, closePrematurly bool) string {
8281
}
8382

8483
func TestEmailHandler(t *testing.T) {
85-
8684
tests := []struct {
8785
expected string
8886
}{
@@ -104,7 +102,6 @@ func TestEmailHandler(t *testing.T) {
104102
email.SetTimestampFormat("MST")
105103
email.SetTemplate(defaultTemplate)
106104
email.SetEmailConfig("localhost", 3041, "", "", "[email protected]", []string{"[email protected]"})
107-
email.SetEnabled(true)
108105
// email.SetFormatFunc(testFormatFunc)
109106
log.AddHandler(email, log.InfoLevel, log.DebugLevel)
110107

@@ -211,6 +208,18 @@ func TestBadSend(t *testing.T) {
211208
log.Info("info")
212209
}
213210

211+
func TestBadEnabled(t *testing.T) {
212+
email := New("localhost", 3041, "", "", "[email protected]", []string{"[email protected]"})
213+
email.SetEnabled(false)
214+
log.AddHandler(email, log.InfoLevel)
215+
216+
if email.enabled {
217+
t.Errorf("Expected 'false' Got 'true'")
218+
}
219+
220+
log.Info("info")
221+
}
222+
214223
func testFormatFunc(email *Email) Formatter {
215224
var err error
216225
b := new(bytes.Buffer)

0 commit comments

Comments
 (0)