-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
smtp_builder_test.go
29 lines (23 loc) · 1.17 KB
/
smtp_builder_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package truemail
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSmtpBuilderNewSmtpRequest(t *testing.T) {
t.Run("creates new configured SMTP request", func(t *testing.T) {
attempts, targetEmail, targetHostAddress, configuration := randomPositiveNumber(), randomEmail(), randomIpAddress(), createConfiguration()
smtpRequestConfiguration := newSmtpRequestConfiguration(configuration, targetEmail, targetHostAddress)
smtpRequest := new(smtpBuilder).newSmtpRequest(attempts, targetEmail, targetHostAddress, configuration)
assert.Equal(t, attempts, smtpRequest.Attempts)
assert.Equal(t, targetEmail, smtpRequest.Email)
assert.Equal(t, targetHostAddress, smtpRequest.Host)
assert.Equal(t, smtpRequestConfiguration, smtpRequest.Configuration)
assert.Equal(t, new(SmtpResponse), smtpRequest.Response)
})
}
func TestSmtpBuilderNewSmtpClient(t *testing.T) {
t.Run("creates new configured SMTP client", func(t *testing.T) {
smtpRequestConfiguration := newSmtpRequestConfiguration(createConfiguration(), randomEmail(), randomIpAddress())
assert.Equal(t, newSmtpClient(smtpRequestConfiguration), new(smtpBuilder).newSmtpClient(smtpRequestConfiguration))
})
}