def test_authenticate(self):
        kunal = User.objects.create(username='kunal', email='kunal@lol.lol')
        kunal.set_password('mehta')
        kunal.is_active = False
        kunal.save()

        def assert_raises(username, password, message):
            with self.assertRaises(AuthenticationError):
                try:
                    User.authenticate(username, password)
                except AuthenticationError as e:
                    self.assertEqual(str(e), message)
                    raise

        assert_raises('kunal', '', AuthenticationError.MISSING_FIELDS)
        assert_raises('', 'mehta', AuthenticationError.MISSING_FIELDS)
        assert_raises('kunal', 'm', AuthenticationError.INVALID_CREDENTIALS)
        assert_raises('k', 'mehta', AuthenticationError.INVALID_CREDENTIALS)
        assert_raises('kunal', 'mehta', AuthenticationError.INACTIVE_ACCOUNT)

        kunal.is_active = True
        kunal.save();

        user = User.authenticate('kunal', 'mehta')
        self.assertEqual(user, kunal)
It should correctly authenticate and return a user, or return an
dataset/ETHPy150Open bmun/huxley/huxley/accounts/tests/test_user.py/UserTestCase.test_authenticate