Modernize the LDAP backend.
Review Request #11355 — Created Dec. 29, 2020 and submitted
This fixes up the LDAP backend to work correctly with Python 2 and 3. We
now initialize LDAP withbytes_mode=False
, which will ensure that
python-ldap
will use Unicode strings for all input and output on both
Python 2 and 3. It's the rough equivalent of aunicode_literals
import. That allows us to remove all the casting, which didn't work on
Python 3 anyway without emitting warnings.Log output has been cleaned up, with some improved log output and a
dedicated logger.The unit tests have been improved considerably. We now use spies to
track calls, rather than overriding theLDAPObject
with a per-test
subclass. This allows us to ensure these overridden functions are
actually called, which was just an assumption we made before.We didn't require LDAP support for development in the past, which meant
that some tests recently regressed. It's now a development-time
dependency. We also require a modern version for production.
Unit tests pass for all versions of Python.
- Change Summary:
-
Added missing parts of the commit.
- Commits:
-
Summary ID f15bd91f7e2c194cc1d0eaa894424b19a4722e37 ce8fb24401e199b4c91da134337b3179bf3f3e7c
Checks run (2 succeeded)
- Change Summary:
-
Fixed up some of the fake return values for
search_s
to always be a tuple with attributes, even if the caller doesn't care. - Commits:
-
Summary ID ce8fb24401e199b4c91da134337b3179bf3f3e7c ca77e76fbf4fefd2b4e75485c4855458943e0bdd