mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-19 05:58:34 +02:00
ldap auth: fixed unit test.
This commit is contained in:
@@ -119,7 +119,7 @@ class LDAPAuthenticationTestCase(LDAPTestCaseMixin, ModoTestCase):
|
||||
})
|
||||
username = "mailadmin"
|
||||
self.authenticate(username, "test", False)
|
||||
self.check_created_user(username, "DomainAdmins", False)
|
||||
self.check_created_user("mailadmin@example.com", "DomainAdmins", False)
|
||||
|
||||
|
||||
class ProfileTestCase(LDAPTestCaseMixin, ModoTestCase):
|
||||
|
||||
@@ -92,9 +92,13 @@ try:
|
||||
if attr in ldap_user.attrs:
|
||||
email = ldap_user.attrs[attr][0]
|
||||
break
|
||||
if email is None and group == "SimpleUsers":
|
||||
return None
|
||||
username = email
|
||||
if email is None:
|
||||
if group == "SimpleUsers":
|
||||
# Only DomainAdmins can have a username which
|
||||
# is not an email address
|
||||
return None
|
||||
else:
|
||||
username = email
|
||||
user, created = User.objects.get_or_create(
|
||||
username__iexact=username,
|
||||
defaults={
|
||||
|
||||
Reference in New Issue
Block a user