src/auth/routes.py : blueprint auth et fixtures de test (#73)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
auth_bp = Blueprint("auth", __name__, url_prefix="/auth")
|
||||||
@@ -43,6 +43,10 @@ def init_auth(app: Flask) -> None:
|
|||||||
_login_manager.user_loader(load_user)
|
_login_manager.user_loader(load_user)
|
||||||
_login_manager.init_app(app)
|
_login_manager.init_app(app)
|
||||||
|
|
||||||
|
from src.auth.routes import auth_bp
|
||||||
|
|
||||||
|
app.register_blueprint(auth_bp)
|
||||||
|
|
||||||
_csrf = CSRFProtect(app)
|
_csrf = CSRFProtect(app)
|
||||||
|
|
||||||
if not os.getenv("SMTP_HOST"):
|
if not os.getenv("SMTP_HOST"):
|
||||||
|
|||||||
@@ -10,3 +10,26 @@ def users_db_path(monkeypatch, tmp_path):
|
|||||||
reset_conn_for_tests()
|
reset_conn_for_tests()
|
||||||
yield db_path
|
yield db_path
|
||||||
reset_conn_for_tests()
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user