golang-lib/mailer/main_test.go

26 lines
388 B
Go
Raw Normal View History

2021-06-21 16:30:34 +02:00
package mailer
2021-06-23 20:48:08 +02:00
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSetupAndPing(t *testing.T) {
assert := assert.New(t)
mock, s := NewFakeServer()
assert.NotNil(mock)
// correct setup
err := s.Setup()
assert.NoError(err)
mock.Close()
s.SMTPPassword = "wrong"
mock, s = newFakeServer(s)
// wrong password
err = s.Setup()
assert.Error(err)
mock.Close()
}