diff options
Diffstat (limited to 'api4/system_test.go')
-rw-r--r-- | api4/system_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/api4/system_test.go b/api4/system_test.go index 2e8b8f70f..ae133183b 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" ) func TestGetPing(t *testing.T) { @@ -64,3 +65,32 @@ func TestGetConfig(t *testing.T) { t.Fatal("did not sanitize properly") } } + +func TestEmailTest(t *testing.T) { + th := Setup().InitBasic().InitSystemAdmin() + defer TearDown() + Client := th.Client + + SendEmailNotifications := utils.Cfg.EmailSettings.SendEmailNotifications + SMTPServer := utils.Cfg.EmailSettings.SMTPServer + SMTPPort := utils.Cfg.EmailSettings.SMTPPort + FeedbackEmail := utils.Cfg.EmailSettings.FeedbackEmail + defer func() { + utils.Cfg.EmailSettings.SendEmailNotifications = SendEmailNotifications + utils.Cfg.EmailSettings.SMTPServer = SMTPServer + utils.Cfg.EmailSettings.SMTPPort = SMTPPort + utils.Cfg.EmailSettings.FeedbackEmail = FeedbackEmail + }() + + utils.Cfg.EmailSettings.SendEmailNotifications = false + utils.Cfg.EmailSettings.SMTPServer = "" + utils.Cfg.EmailSettings.SMTPPort = "" + utils.Cfg.EmailSettings.FeedbackEmail = "" + + _, resp := Client.TestEmail() + CheckForbiddenStatus(t, resp) + + _, resp = th.SystemAdminClient.TestEmail() + CheckErrorMessage(t, resp, "api.admin.test_email.missing_server") + CheckInternalErrorStatus(t, resp) +} |