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
73e8bba379.
This commit is contained in:
Tim Abbott 2017-09-26 21:32:46 -07:00
parent 315f5b393b
commit 8d7f961a67
1 changed files with 4 additions and 2 deletions

View File

@ -434,8 +434,10 @@ class ZulipLDAPAuthBackend(ZulipLDAPAuthBackendBase):
return user_profile return user_profile
except Realm.DoesNotExist: except Realm.DoesNotExist:
return None return None
except ZulipLDAPException: # ZulipLDAPException subclasses _LDAPUser.AuthenticationFailed
return None # 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): def get_or_create_user(self, username, ldap_user):
# type: (str, _LDAPUser) -> Tuple[UserProfile, bool] # type: (str, _LDAPUser) -> Tuple[UserProfile, bool]