Adding durafmt library and use it from enterprise global relay export (#8487)

* Adding durafmt library and use it from enterprise global relay export

* Allow to specify different server host and server name on smtp connections

* Fixing utils/smtp tests
Этот коммит содержится в:
Jesús Espino
2018-03-27 10:23:33 +02:00
коммит произвёл GitHub
родитель 8491ba5740
Коммит 9e6db178b0
15 изменённых файлов: 545 добавлений и 42 удалений

Просмотреть файл

@@ -47,7 +47,8 @@ func TestMailConnectionAdvanced(t *testing.T) {
&SmtpConnectionInfo{
ConnectionSecurity: cfg.EmailSettings.ConnectionSecurity,
SkipCertVerification: *cfg.EmailSettings.SkipServerCertificateVerification,
SmtpServer: cfg.EmailSettings.SMTPServer,
SmtpServerName: cfg.EmailSettings.SMTPServer,
SmtpServerHost: cfg.EmailSettings.SMTPServer,
SmtpPort: cfg.EmailSettings.SMTPPort,
},
); err != nil {
@@ -60,7 +61,8 @@ func TestMailConnectionAdvanced(t *testing.T) {
&SmtpConnectionInfo{
ConnectionSecurity: cfg.EmailSettings.ConnectionSecurity,
SkipCertVerification: *cfg.EmailSettings.SkipServerCertificateVerification,
SmtpServer: cfg.EmailSettings.SMTPServer,
SmtpServerName: cfg.EmailSettings.SMTPServer,
SmtpServerHost: cfg.EmailSettings.SMTPServer,
SmtpPort: cfg.EmailSettings.SMTPPort,
Auth: *cfg.EmailSettings.EnableSMTPAuth,
SmtpUsername: cfg.EmailSettings.SMTPUsername,
@@ -76,7 +78,8 @@ func TestMailConnectionAdvanced(t *testing.T) {
&SmtpConnectionInfo{
ConnectionSecurity: cfg.EmailSettings.ConnectionSecurity,
SkipCertVerification: *cfg.EmailSettings.SkipServerCertificateVerification,
SmtpServer: "wrongServer",
SmtpServerName: "wrongServer",
SmtpServerHost: "wrongServer",
SmtpPort: "553",
},
); err == nil {
@@ -225,10 +228,11 @@ func TestSendMailUsingConfigAdvanced(t *testing.T) {
func TestAuthMethods(t *testing.T) {
auth := &authChooser{
connectionInfo: &SmtpConnectionInfo{
SmtpUsername: "test",
SmtpPassword: "fakepass",
SmtpServer: "fakeserver",
SmtpPort: "25",
SmtpUsername: "test",
SmtpPassword: "fakepass",
SmtpServerName: "fakeserver",
SmtpServerHost: "fakeserver",
SmtpPort: "25",
},
}
tests := []struct {