refactor LDAP access in tests