""" tests/conftest.py — makes backend/'s modules importable from tests/ (no package/__init__.py, matching the sightbox backend/'s own flat layout) and builds one Flask test client per test with rate limiting disabled, since Flask-Limiter's in-memory store is a module-level singleton (middleware/rate_limit.py) shared across the whole pytest session — left enabled, the suite's own request volume would eventually trip RATELIMIT_PER_HOUR against itself. """ import os import sys import pytest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from app import create_app # noqa: E402 @pytest.fixture def client(): app = create_app() app.config["TESTING"] = True app.config["RATELIMIT_ENABLED"] = False with app.test_client() as test_client: yield test_client @pytest.fixture def configured_resend(monkeypatch): """Sets the env vars send_email() requires, via Config directly (already-imported module attributes, not os.environ, since Config reads env once at import time).""" import config monkeypatch.setattr(config.Config, "RESEND_API_KEY", "re_test_key") monkeypatch.setattr(config.Config, "MAIL_SENDER_NAME", "Bettersight") monkeypatch.setattr(config.Config, "MAIL_SENDER_ADDRESS", "support@bettersight.io") monkeypatch.setattr(config.Config, "SALES_EMAIL", "sales@bettersight.io")