ghostream/auth/auth_test.go

32 lines
688 B
Go
Raw Normal View History

package auth
2020-10-01 18:11:43 +00:00
import (
2020-10-09 20:17:07 +00:00
"testing"
2020-10-01 18:11:43 +00:00
"gitlab.crans.org/nounous/ghostream/auth/basic"
"gitlab.crans.org/nounous/ghostream/auth/ldap"
)
func TestLoadConfiguration(t *testing.T) {
2020-10-09 20:17:07 +00:00
_, err := New(&Options{
Enabled: true,
Backend: "basic",
Basic: basic.Options{Credentials: make(map[string]string)},
})
2020-10-01 18:11:43 +00:00
if err != nil {
t.Error("Creating basic authentication backend failed:", err)
}
2020-10-09 20:17:07 +00:00
_, err = New(&Options{
Enabled: true,
Backend: "ldap",
LDAP: ldap.Options{URI: "ldap://127.0.0.1:389", UserDn: "cn=users,dc=example,dc=com"},
})
2020-10-01 18:11:43 +00:00
// TODO Maybe start a LDAP server?
if err == nil {
t.Error("Creating ldap authentication backend successed mysteriously:", err)
}
}