from flask import url_for, session from capsulflask.db import get_model from capsulflask.tests_base import BaseTestCase class LoginTests(BaseTestCase): render_templates = False def test_login_request(self): with self.client as client: response = client.get(url_for("auth.login")) self.assert_200(response) # FIXME test generated login link def test_login_magiclink(self): token, ignoreCaseMatches = get_model().login('test@example.com') with self.client as client: response = client.get(url_for("auth.magiclink", token=token)) self.assertRedirects(response, url_for("console.index")) self.assertEqual(session['account'], 'test@example.com')