1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix incorrect cli default values and default command (#34765)

This commit is contained in:
wxiaoguang
2025-06-18 23:25:11 +08:00
committed by GitHub
parent 416ff1fd31
commit 7954f25290
7 changed files with 76 additions and 43 deletions

View File

@@ -60,10 +60,8 @@ func TestAddSMTP(t *testing.T) {
Auth: "PLAIN",
Host: "localhost",
Port: 25,
// ForceSMTPS: true,
// SkipVerify: true,
},
TwoFactorPolicy: "skip",
TwoFactorPolicy: "",
},
},
{
@@ -73,12 +71,12 @@ func TestAddSMTP(t *testing.T) {
"--host", "localhost",
"--port", "25",
"--auth-type", "LOGIN",
"--force-smtps=false",
"--skip-verify=false",
"--force-smtps",
"--skip-verify",
"--helo-hostname", "example.com",
"--disable-helo=false",
"--disable-helo=true",
"--allowed-domains", "example.com,example.org",
"--skip-local-2fa=false",
"--skip-local-2fa",
"--active=false",
},
source: &auth_model.Source{
@@ -89,13 +87,13 @@ func TestAddSMTP(t *testing.T) {
Auth: "LOGIN",
Host: "localhost",
Port: 25,
ForceSMTPS: false,
SkipVerify: false,
ForceSMTPS: true,
SkipVerify: true,
HeloHostname: "example.com",
DisableHelo: false,
DisableHelo: true,
AllowedDomains: "example.com,example.org",
},
TwoFactorPolicy: "",
TwoFactorPolicy: "skip",
},
},
}
@@ -157,13 +155,10 @@ func TestUpdateSMTP(t *testing.T) {
Name: "old name",
IsActive: true,
Cfg: &smtp.Source{
Auth: "PLAIN",
Host: "old host",
Port: 26,
ForceSMTPS: true,
SkipVerify: true,
Auth: "PLAIN",
Host: "old host",
Port: 26,
},
TwoFactorPolicy: "",
},
args: []string{
"--id", "1",
@@ -177,13 +172,10 @@ func TestUpdateSMTP(t *testing.T) {
Name: "test",
IsActive: true,
Cfg: &smtp.Source{
Auth: "PLAIN",
Host: "localhost",
Port: 25,
ForceSMTPS: true,
SkipVerify: true,
Auth: "PLAIN",
Host: "localhost",
Port: 25,
},
TwoFactorPolicy: "skip",
},
},
{
@@ -197,10 +189,7 @@ func TestUpdateSMTP(t *testing.T) {
Auth: "PLAIN",
Host: "old host",
Port: 26,
ForceSMTPS: true,
SkipVerify: true,
HeloHostname: "old.example.com",
DisableHelo: false,
AllowedDomains: "old.example.com",
},
TwoFactorPolicy: "",
@@ -211,12 +200,12 @@ func TestUpdateSMTP(t *testing.T) {
"--host", "localhost",
"--port", "25",
"--auth-type", "LOGIN",
"--force-smtps=false",
"--skip-verify=false",
"--force-smtps",
"--skip-verify",
"--helo-hostname", "example.com",
"--disable-helo=true",
"--disable-helo",
"--allowed-domains", "example.com,example.org",
"--skip-local-2fa=true",
"--skip-local-2fa",
"--active=false",
},
authSource: &auth_model.Source{
@@ -228,8 +217,8 @@ func TestUpdateSMTP(t *testing.T) {
Auth: "LOGIN",
Host: "localhost",
Port: 25,
ForceSMTPS: false,
SkipVerify: false,
ForceSMTPS: true,
SkipVerify: true,
HeloHostname: "example.com",
DisableHelo: true,
AllowedDomains: "example.com,example.org",
@@ -252,11 +241,8 @@ func TestUpdateSMTP(t *testing.T) {
Name: "test",
IsActive: true,
Cfg: &smtp.Source{
Auth: "PLAIN",
SkipVerify: true,
ForceSMTPS: true,
Auth: "PLAIN",
},
TwoFactorPolicy: "skip",
}, nil
},