forked from forgejo/forgejo
parent
29637b03b2
commit
c355728a6f
5 changed files with 8 additions and 20 deletions
|
@ -10,7 +10,6 @@ import (
|
|||
)
|
||||
|
||||
func Test_loadMailerFrom(t *testing.T) {
|
||||
iniFile := NewEmptyConfigProvider()
|
||||
kases := map[string]*Mailer{
|
||||
"smtp.mydomain.com": {
|
||||
SMTPAddr: "smtp.mydomain.com",
|
||||
|
@ -27,13 +26,13 @@ func Test_loadMailerFrom(t *testing.T) {
|
|||
}
|
||||
for host, kase := range kases {
|
||||
t.Run(host, func(t *testing.T) {
|
||||
iniFile.DeleteSection("mailer")
|
||||
sec := iniFile.Section("mailer")
|
||||
cfg, _ := NewConfigProviderFromData("")
|
||||
sec := cfg.Section("mailer")
|
||||
sec.NewKey("ENABLED", "true")
|
||||
sec.NewKey("HOST", host)
|
||||
|
||||
// Check mailer setting
|
||||
loadMailerFrom(iniFile)
|
||||
loadMailerFrom(cfg)
|
||||
|
||||
assert.EqualValues(t, kase.SMTPAddr, MailService.SMTPAddr)
|
||||
assert.EqualValues(t, kase.SMTPPort, MailService.SMTPPort)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue