diff --git a/src/auth/routes.py b/src/auth/routes.py new file mode 100644 index 0000000..63de288 --- /dev/null +++ b/src/auth/routes.py @@ -0,0 +1,3 @@ +from flask import Blueprint + +auth_bp = Blueprint("auth", __name__, url_prefix="/auth") diff --git a/src/auth/setup.py b/src/auth/setup.py index adf621b..bf16502 100644 --- a/src/auth/setup.py +++ b/src/auth/setup.py @@ -43,6 +43,10 @@ def init_auth(app: Flask) -> None: _login_manager.user_loader(load_user) _login_manager.init_app(app) + from src.auth.routes import auth_bp + + app.register_blueprint(auth_bp) + _csrf = CSRFProtect(app) if not os.getenv("SMTP_HOST"): diff --git a/tests/auth/conftest.py b/tests/auth/conftest.py index ce77c3b..ee11048 100644 --- a/tests/auth/conftest.py +++ b/tests/auth/conftest.py @@ -10,3 +10,26 @@ def users_db_path(monkeypatch, tmp_path): reset_conn_for_tests() yield db_path reset_conn_for_tests() + + +@pytest.fixture +def app(users_db_path, monkeypatch): + from flask import Flask + + from src.auth.setup import init_auth + + app = Flask(__name__) + init_auth(app) + yield app + + +@pytest.fixture +def client(app): + return app.test_client() + + +@pytest.fixture +def mail_outbox(app): + mail = app.extensions["mail"] + with mail.record_messages() as outbox: + yield outbox