outposts/ldap: add more tests (#6188)
* outposts/ldap: add tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix missing posixAccount Signed-off-by: Jens Langhammer <jens@goauthentik.io> * attempt to expand attributes Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix routing without base DN Signed-off-by: Jens Langhammer <jens@goauthentik.io> * more logging Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove our custom attribute filtering since this is done by the ldap library Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add test for schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
27
internal/outpost/ldap/entries_test.go
Normal file
27
internal/outpost/ldap/entries_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package ldap_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"beryju.io/ldap"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"goauthentik.io/api/v3"
|
||||
)
|
||||
|
||||
func Test_UserEntry(t *testing.T) {
|
||||
pi := ProviderInstance()
|
||||
u := api.User{
|
||||
Username: "foo",
|
||||
Name: "bar",
|
||||
}
|
||||
entry := pi.UserEntry(u)
|
||||
assert.Equal(t, "cn=foo,ou=users,dc=ldap,dc=goauthentik,dc=io", entry.DN)
|
||||
assert.Contains(t, entry.Attributes, &ldap.EntryAttribute{
|
||||
Name: "cn",
|
||||
Values: []string{u.Username},
|
||||
})
|
||||
assert.Contains(t, entry.Attributes, &ldap.EntryAttribute{
|
||||
Name: "displayName",
|
||||
Values: []string{u.Name},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user