summaryrefslogtreecommitdiff
path: root/internal/configuration/validator/authentication_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/configuration/validator/authentication_test.go')
-rw-r--r--internal/configuration/validator/authentication_test.go17
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{}