flake8
-
reviewboard/accounts/tests/test_ldap_auth_backend.py (Diff revision 1)
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.
Added missing parts of the commit.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+742 -454) |
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: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+744 -466) |
Nice cleanup.
reviewboard/accounts/backends/ldap.py (Diff revision 3) |
---|
Wrapping here is a little weird--I'd say either every arg on its own line or wrap to width, but not halfsies.