Merge branch 'Aufinal/ldap_mail' into 'master'

Utilise le mail LDAP lors de l'inscription d'utilisateurs

Closes #268

See merge request klub-dev-ens/gestioCOF!437
This commit is contained in:
Martin Pepin 2020-08-25 19:08:25 +02:00
commit 2cf0ccbb6b
6 changed files with 20 additions and 12 deletions

View file

@ -329,15 +329,15 @@ class RegistrationAutocompleteViewTests(MockLDAPMixin, ViewTestCaseMixin, TestCa
self._test("wy bd", [self.u2], [self.m1], [])
def test_clipper(self):
mock_ldap = self.mockLDAP([("uid", "first last")])
mock_ldap = self.mockLDAP([("uid", "first last", "mail")])
self._test("aa bb", [], [], [Clipper("uid", "first last")])
self._test("aa bb", [], [], [Clipper("uid", "first last", "mail")])
mock_ldap.ldap_obj.search_s.assert_called_once_with(
"dc=spi,dc=ens,dc=fr",
mock_ldap.SCOPE_SUBTREE,
"(&(|(cn=*aa*)(uid=*aa*))(|(cn=*bb*)(uid=*bb*)))",
["cn", "uid"],
["cn", "uid", "mail"],
)
def test_clipper_escaped(self):
@ -348,9 +348,9 @@ class RegistrationAutocompleteViewTests(MockLDAPMixin, ViewTestCaseMixin, TestCa
mock_ldap.ldap_obj.search_s.assert_not_called()
def test_clipper_no_duplicate(self):
self.mockLDAP([("uid", "abc")])
self.mockLDAP([("uid", "abc", "mail")])
self._test("abc", [self.u1], [], [Clipper("uid", "abc")])
self._test("abc", [self.u1], [], [Clipper("uid", "abc", "mail")])
self.u1.username = "uid"
self.u1.save()