Modernize the LDAP backend.

Review Request #11355 — Created Dec. 29, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

This fixes up the LDAP backend to work correctly with Python 2 and 3. We
now initialize LDAP with bytes_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 a unicode_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 the LDAPObject 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.

Commits

Files