app/testEmail: remove a setting that blocks testEmail (#15022)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
16ffb6712f
Коммит
1fadfa9f33
@@ -5,6 +5,7 @@ package api4
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
@@ -98,18 +99,31 @@ func TestEmailTest(t *testing.T) {
|
|||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
Client := th.Client
|
Client := th.Client
|
||||||
|
|
||||||
|
dir, err := ioutil.TempDir("", "")
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
config := model.Config{
|
config := model.Config{
|
||||||
ServiceSettings: model.ServiceSettings{
|
ServiceSettings: model.ServiceSettings{
|
||||||
SiteURL: model.NewString(""),
|
SiteURL: model.NewString(""),
|
||||||
},
|
},
|
||||||
EmailSettings: model.EmailSettings{
|
EmailSettings: model.EmailSettings{
|
||||||
SMTPServer: model.NewString(""),
|
SMTPServer: model.NewString(""),
|
||||||
SMTPPort: model.NewString(""),
|
SMTPPort: model.NewString(""),
|
||||||
SMTPPassword: model.NewString(""),
|
SMTPPassword: model.NewString(""),
|
||||||
FeedbackName: model.NewString(""),
|
FeedbackName: model.NewString(""),
|
||||||
FeedbackEmail: model.NewString(""),
|
FeedbackEmail: model.NewString("some-addr@test.com"),
|
||||||
ReplyToAddress: model.NewString(""),
|
ReplyToAddress: model.NewString("some-addr@test.com"),
|
||||||
SendEmailNotifications: model.NewBool(false),
|
ConnectionSecurity: model.NewString(""),
|
||||||
|
SMTPUsername: model.NewString(""),
|
||||||
|
EnableSMTPAuth: model.NewBool(false),
|
||||||
|
SkipServerCertificateVerification: model.NewBool(true),
|
||||||
|
SendEmailNotifications: model.NewBool(false),
|
||||||
|
SMTPServerTimeout: model.NewInt(15),
|
||||||
|
},
|
||||||
|
FileSettings: model.FileSettings{
|
||||||
|
DriverName: model.NewString(model.IMAGE_DRIVER_LOCAL),
|
||||||
|
Directory: model.NewString(dir),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,9 +142,9 @@ func TestEmailTest(t *testing.T) {
|
|||||||
inbucket_host = "localhost"
|
inbucket_host = "localhost"
|
||||||
}
|
}
|
||||||
|
|
||||||
inbucket_port := os.Getenv("CI_INBUCKET_PORT")
|
inbucket_port := os.Getenv("CI_INBUCKET_SMTP_PORT")
|
||||||
if inbucket_port == "" {
|
if inbucket_port == "" {
|
||||||
inbucket_port = "9000"
|
inbucket_port = "10025"
|
||||||
}
|
}
|
||||||
|
|
||||||
*config.EmailSettings.SMTPServer = inbucket_host
|
*config.EmailSettings.SMTPServer = inbucket_host
|
||||||
|
|||||||
@@ -201,10 +201,6 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError {
|
|||||||
return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusBadRequest)
|
return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !*cfg.EmailSettings.SendEmailNotifications {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the user hasn't changed their email settings, fill in the actual SMTP password so that
|
// if the user hasn't changed their email settings, fill in the actual SMTP password so that
|
||||||
// the user can verify an existing SMTP connection
|
// the user can verify an existing SMTP connection
|
||||||
if *cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
if *cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user