How do i test for authentication in django

def authenticate(username=None, password=None):
        try:
            user = User.objects.get(email=username)
            if user.check_password(raw_password=password):
                return user
            return None
        except User.DoesNotExist:
            return None

def authenticate(username=None, password=None): try: user = User.objects.get(email=username) if user.check_password(raw_password=password): return user return None except User.DoesNotExist: return None

Back to Top