From 8d7f961a67156c4b93065412020d3bb87fbeebc1 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 26 Sep 2017 21:32:46 -0700 Subject: [PATCH] LDAP: Remove now-impossible except clause. Since we made ZulipLDAPException a subclass of _LDAPUser.AuthenticationFailed, the django-auth-ldap library already handles catching it and returning None. This fixes missing test coverage in this function introduced by 73e8bba379be7d4f0c8f97def6109cb3de5b6899. --- zproject/backends.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zproject/backends.py b/zproject/backends.py index 438166a93e..ae424752d6 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -434,8 +434,10 @@ class ZulipLDAPAuthBackend(ZulipLDAPAuthBackendBase): return user_profile except Realm.DoesNotExist: return None - except ZulipLDAPException: - return None + # ZulipLDAPException subclasses _LDAPUser.AuthenticationFailed + # and thus will automatically be caught and return None via + # django-auth-ldap's existing code, so we don't need to catch + # them here. def get_or_create_user(self, username, ldap_user): # type: (str, _LDAPUser) -> Tuple[UserProfile, bool]