diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2021-03-22 20:04:09 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-22 20:04:09 +1100 |
| commit | a44f0cf959bfb2c20a3defe7c92f8018799ead86 (patch) | |
| tree | 14486e0df62df1a74ee55f34c0cb71832af5b268 /internal/configuration/validator/authentication_test.go | |
| parent | 7ccbaaffe39aa26dd60e7ae99998fd795b2d80cc (diff) | |
fix: redis sentinel secret missing (#1839)
* fix: redis sentinel secret missing
* refactor: use consts for authentication_backend.file.password errs
* fix: unit test for new default port
* test: cover additional misses
* test: fix windows/linux specific test error
* test: more windows specific tests
* test: remove superfluous url.IsAbs
* test: validator 100% coverage
Diffstat (limited to 'internal/configuration/validator/authentication_test.go')
| -rw-r--r-- | internal/configuration/validator/authentication_test.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/configuration/validator/authentication_test.go b/internal/configuration/validator/authentication_test.go index 574a5b041..873ecdea1 100644 --- a/internal/configuration/validator/authentication_test.go +++ b/internal/configuration/validator/authentication_test.go @@ -10,7 +10,22 @@ import ( "github.com/authelia/authelia/internal/configuration/schema" ) -func TestShouldRaiseErrorsWhenNoBackendProvided(t *testing.T) { +func TestShouldRaiseErrorWhenBothBackendsProvided(t *testing.T) { + validator := schema.NewStructValidator() + backendConfig := schema.AuthenticationBackendConfiguration{} + + backendConfig.Ldap = &schema.LDAPAuthenticationBackendConfiguration{} + backendConfig.File = &schema.FileAuthenticationBackendConfiguration{ + Path: "/tmp", + } + + ValidateAuthenticationBackend(&backendConfig, validator) + + require.Len(t, validator.Errors(), 1) + assert.EqualError(t, validator.Errors()[0], "You cannot provide both `ldap` and `file` objects in `authentication_backend`") +} + +func TestShouldRaiseErrorWhenNoBackendProvided(t *testing.T) { validator := schema.NewStructValidator() backendConfig := schema.AuthenticationBackendConfiguration{} |
