forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ulbrich Robert <[email protected]>
- Loading branch information
1 parent
64f3333
commit 50ce320
Showing
2 changed files
with
180 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,16 +95,16 @@ func TestCreateClient(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Hello", "localhost").Return(nil) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "") | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
}).Return(nil) | ||
smtpClient.On("Extension", "AUTH").Return(true, "") | ||
smtpClient.On("Auth", auth).Return(nil) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -124,7 +124,7 @@ func TestCreateClientErrorCreatingClient(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, errors.New("error creating client")) | ||
|
||
|
@@ -144,8 +144,8 @@ func TestCreateClientErrorHello(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Hello("localhost").Return(errors.New("Error with hello")).Times(1) | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Hello", "localhost").Return(errors.New("Error with hello")) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -165,10 +165,10 @@ func TestCreateClientErrorStartTLS(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
|
@@ -192,16 +192,16 @@ func TestCreateClientErrorAuth(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(errors.New("Error with hello")).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(errors.New("Error with hello")).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -223,22 +223,22 @@ func TestSendMail(t *testing.T) { | |
|
||
stringWriter := StringWriter{buffer: ""} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Data().Return(&stringWriter, nil).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Data").Return(&stringWriter, nil).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -266,10 +266,10 @@ func TestSendMailCreateClientError(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(errors.New("error hello")).Times(1) | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(errors.New("error hello")).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -292,19 +292,19 @@ func TestSendMailErrorMail(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(errors.New("error sending mail")).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(errors.New("error sending mail")).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -327,20 +327,20 @@ func TestSendMailErrorRecipient(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(errors.New("error adding recipient")).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(errors.New("error adding recipient")).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -363,22 +363,22 @@ func TestSendMailErrorData(t *testing.T) { | |
MinVersion: tls.VersionTLS13, | ||
} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Data().Return(nil, errors.New("error creating data writer")).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Data").Return(nil, errors.New("error creating data writer")).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -404,22 +404,22 @@ func TestSendMailErrorWriting(t *testing.T) { | |
|
||
stringWriter := StringWriter{buffer: "", writeErr: errors.New("error writing"), closeErr: nil} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Data().Return(&stringWriter, nil).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Data").Return(&stringWriter, nil).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
@@ -445,22 +445,22 @@ func TestSendMailErrorClose(t *testing.T) { | |
|
||
stringWriter := StringWriter{buffer: "", writeErr: nil, closeErr: errors.New("error writing")} | ||
|
||
smtpClient := notification_mocks.NewSMTPClient(t) | ||
smtpClient.EXPECT().Noop().Return(errors.New("no connection")).Times(1) | ||
smtpClient.EXPECT().Close().Return(nil).Times(1) | ||
smtpClient.EXPECT().Hello("localhost").Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("STARTTLS").Return(true, "").Times(1) | ||
smtpClient.EXPECT().StartTLS(&tls.Config{ | ||
smtpClient := ¬ification_mocks.SMTPClient{} | ||
smtpClient.On("Noop").Return(errors.New("no connection")).Times(1) | ||
smtpClient.On("Close").Return(nil).Times(1) | ||
smtpClient.On("Hello", "localhost").Return(nil).Times(1) | ||
smtpClient.On("Extension", "STARTTLS").Return(true, "").Times(1) | ||
smtpClient.On("StartTLS", &tls.Config{ | ||
InsecureSkipVerify: false, | ||
ServerName: "localhost", | ||
MinVersion: tls.VersionTLS13, | ||
}).Return(nil).Times(1) | ||
smtpClient.EXPECT().Extension("AUTH").Return(true, "").Times(1) | ||
smtpClient.EXPECT().Auth(auth).Return(nil).Times(1) | ||
smtpClient.EXPECT().Mail("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Rcpt("[email protected]").Return(nil).Times(1) | ||
smtpClient.EXPECT().Data().Return(&stringWriter, nil).Times(1) | ||
smtpClient.On("Extension", "AUTH").Return(true, "").Times(1) | ||
smtpClient.On("Auth", auth).Return(nil).Times(1) | ||
smtpClient.On("Mail", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Rcpt", "[email protected]").Return(nil).Times(1) | ||
smtpClient.On("Data").Return(&stringWriter, nil).Times(1) | ||
|
||
smtpEmailer := createSMTPEmailer(smtpClient, &tlsConf, &auth, nil) | ||
|
||
|
Oops, something went wrong.