|
|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
|
"net/textproto" |
|
|
|
|
"strings" |
|
|
|
|
"testing" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
smtpmock "github.com/mocktools/go-smtp-mock/v2" |
|
|
|
|
"github.com/stretchr/testify/assert" |
|
|
|
@ -150,10 +151,9 @@ func TestSmtpDialer(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestSmtpSend(t *testing.T) { |
|
|
|
|
// Test is currently very flaky. Skipping it for now.
|
|
|
|
|
t.Skip() |
|
|
|
|
srv := smtpmock.New(smtpmock.ConfigurationAttr{ |
|
|
|
|
MultipleRcptto: true, |
|
|
|
|
HostAddress: "127.0.0.1", |
|
|
|
|
}) |
|
|
|
|
require.NoError(t, srv.Start()) |
|
|
|
|
defer func() { _ = srv.Stop() }() |
|
|
|
@ -183,6 +183,8 @@ func TestSmtpSend(t *testing.T) { |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, 1, count) |
|
|
|
|
|
|
|
|
|
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
|
|
|
|
time.Sleep(1 * time.Millisecond) |
|
|
|
|
messages := srv.MessagesAndPurge() |
|
|
|
|
require.Len(t, messages, 1) |
|
|
|
|
sentMsg := messages[0] |
|
|
|
@ -233,6 +235,8 @@ func TestSmtpSend(t *testing.T) { |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, 1, count) |
|
|
|
|
|
|
|
|
|
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
|
|
|
|
time.Sleep(1 * time.Millisecond) |
|
|
|
|
messages := srv.MessagesAndPurge() |
|
|
|
|
require.Len(t, messages, 1) |
|
|
|
|
sentMsg := messages[0] |
|
|
|
@ -292,6 +296,8 @@ func TestSmtpSend(t *testing.T) { |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, 3, count) |
|
|
|
|
|
|
|
|
|
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
|
|
|
|
time.Sleep(1 * time.Millisecond) |
|
|
|
|
messages := srv.MessagesAndPurge() |
|
|
|
|
require.Len(t, messages, 3) |
|
|
|
|
|
|
|
|
|