summaryrefslogtreecommitdiffstats
path: root/api4/system_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-13 16:09:00 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 15:09:00 +0000
commit38958d9ac4f415d9ae99dfcdb53bfdc355d96764 (patch)
tree6a92500ed7b9f13f0da0c1f84fc43b674621b36e /api4/system_test.go
parent19c67d7fe35f92ae8a288dcdb9877d3bede41a61 (diff)
downloadchat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.tar.gz
chat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.tar.bz2
chat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.zip
Add implementation for POST /email/test apiV4 - Send Test Email (#5716)
Diffstat (limited to 'api4/system_test.go')
-rw-r--r--api4/system_test.go30
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)
+}