fix expected strings in some test cases

plain strings were converted to translation codes

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-02-03 12:51:12 +01:00
parent 71e01ab26d
commit dcecb79f63
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -433,7 +433,7 @@ func TestInitialization(t *testing.T) {
CertificateKeyFile: "akey", CertificateKeyFile: "akey",
} }
assert.False(t, binding.HasProxy()) assert.False(t, binding.HasProxy())
assert.Equal(t, "Disabled", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSDisabled, binding.GetTLSDescription())
err := c.Initialize(configDir) err := c.Initialize(configDir)
assert.Error(t, err) assert.Error(t, err)
c.CertificateFile = "" c.CertificateFile = ""
@ -490,7 +490,7 @@ func TestInitialization(t *testing.T) {
Port: 2121, Port: 2121,
ClientAuthType: 1, ClientAuthType: 1,
} }
assert.Equal(t, "Disabled", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSDisabled, binding.GetTLSDescription())
certPath := filepath.Join(os.TempDir(), "test_ftpd.crt") certPath := filepath.Join(os.TempDir(), "test_ftpd.crt")
keyPath := filepath.Join(os.TempDir(), "test_ftpd.key") keyPath := filepath.Join(os.TempDir(), "test_ftpd.key")
binding.CertificateFile = certPath binding.CertificateFile = certPath
@ -505,7 +505,7 @@ func TestInitialization(t *testing.T) {
certMgr, err = common.NewCertManager(keyPairs, configDir, "") certMgr, err = common.NewCertManager(keyPairs, configDir, "")
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, "Plain and explicit", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSMixed, binding.GetTLSDescription())
server = NewServer(c, configDir, binding, 0) server = NewServer(c, configDir, binding, 0)
cfg, err := server.GetTLSConfig() cfg, err := server.GetTLSConfig()
require.NoError(t, err) require.NoError(t, err)
@ -541,15 +541,15 @@ func TestServerGetSettings(t *testing.T) {
assert.Error(t, err) assert.Error(t, err)
server.binding.Port = 8021 server.binding.Port = 8021
assert.Equal(t, "Disabled", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSDisabled, binding.GetTLSDescription())
_, err = server.GetTLSConfig() _, err = server.GetTLSConfig()
assert.Error(t, err) // TLS configured but cert manager has no certificate assert.Error(t, err) // TLS configured but cert manager has no certificate
binding.TLSMode = 1 binding.TLSMode = 1
assert.Equal(t, "Explicit required", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSExplicit, binding.GetTLSDescription())
binding.TLSMode = 2 binding.TLSMode = 2
assert.Equal(t, "Implicit", binding.GetTLSDescription()) assert.Equal(t, util.I18nFTPTLSImplicit, binding.GetTLSDescription())
certPath := filepath.Join(os.TempDir(), "test_ftpd.crt") certPath := filepath.Join(os.TempDir(), "test_ftpd.crt")
keyPath := filepath.Join(os.TempDir(), "test_ftpd.key") keyPath := filepath.Join(os.TempDir(), "test_ftpd.key")