def test_auth_by_username_or_email(self): user = self.user backend = AuthenticationBackend() self.assertEqual( backend.authenticate(username=user.email, password=user.username).pk, user.pk) self.assertEqual( backend.authenticate(username=user.username, password=user.username).pk, user.pk)
def test_auth_by_email(self): '''Test authentication with email.''' user = self.user backend = AuthenticationBackend() self.assertEqual( backend.authenticate(username=user.email, password=user.username).pk, user.pk) self.assertEqual( backend.authenticate(username=user.username, password=user.username), None)