summaryrefslogtreecommitdiffstats
path: root/api/admin_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-01-17 15:01:41 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-17 09:01:41 -0500
commitdc54e640c296d50c51858fa50256b3aed9e0a46c (patch)
treeb5b9dc2b044535570cb885307de366136c2b3419 /api/admin_test.go
parent97a51b0e31692b7f86a9971ad36d62b04100fffb (diff)
downloadchat-dc54e640c296d50c51858fa50256b3aed9e0a46c.tar.gz
chat-dc54e640c296d50c51858fa50256b3aed9e0a46c.tar.bz2
chat-dc54e640c296d50c51858fa50256b3aed9e0a46c.zip
Add inbucket docker image to allow local and automated testing of emails (#4901)
* add docker container for inbucket * Add way to get the emails using inbucket and add a test for reset password * add config setting to send emails * update TestEmailTest update * add another test and fix wrong assert * update per review fix lint change senders email * Revert config.json to default values for EmailSettings section * update test * add setup to make the test run
Diffstat (limited to 'api/admin_test.go')
-rw-r--r--api/admin_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index f97d76855..801ad8f21 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -160,6 +160,22 @@ func TestRecycleDatabaseConnection(t *testing.T) {
func TestEmailTest(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
+ 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 = ""
+
if _, err := th.BasicClient.TestEmail(utils.Cfg); err == nil {
t.Fatal("Shouldn't have permissions")
}