summaryrefslogtreecommitdiffstats
path: root/utils/mail_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/mail_test.go')
-rw-r--r--utils/mail_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/mail_test.go b/utils/mail_test.go
index 1d4643429..a4444eb2e 100644
--- a/utils/mail_test.go
+++ b/utils/mail_test.go
@@ -9,30 +9,30 @@ import (
)
func TestMailConnection(t *testing.T) {
- LoadGlobalConfig("config.json")
+ cfg := LoadGlobalConfig("config.json")
- if conn, err := connectToSMTPServer(Cfg); err != nil {
+ if conn, err := connectToSMTPServer(cfg); err != nil {
t.Log(err)
t.Fatal("Should connect to the STMP Server")
} else {
- if _, err1 := newSMTPClient(conn, Cfg); err1 != nil {
+ if _, err1 := newSMTPClient(conn, cfg); err1 != nil {
t.Log(err)
t.Fatal("Should get new smtp client")
}
}
- Cfg.EmailSettings.SMTPServer = "wrongServer"
- Cfg.EmailSettings.SMTPPort = "553"
+ cfg.EmailSettings.SMTPServer = "wrongServer"
+ cfg.EmailSettings.SMTPPort = "553"
- if _, err := connectToSMTPServer(Cfg); err == nil {
+ if _, err := connectToSMTPServer(cfg); err == nil {
t.Log(err)
t.Fatal("Should not to the STMP Server")
}
}
-func TestSendMail(t *testing.T) {
- LoadGlobalConfig("config.json")
+func TestSendMailUsingConfig(t *testing.T) {
+ cfg := LoadGlobalConfig("config.json")
T = GetUserTranslations("en")
var emailTo string = "test@example.com"
@@ -42,7 +42,7 @@ func TestSendMail(t *testing.T) {
//Delete all the messages before check the sample email
DeleteMailBox(emailTo)
- if err := SendMail(emailTo, emailSubject, emailBody); err != nil {
+ if err := SendMailUsingConfig(emailTo, emailSubject, emailBody, cfg); err != nil {
t.Log(err)
t.Fatal("Should connect to the STMP Server")
} else {