"""Общие хелперы для тестов zootech-страниц (не /recipes).""" from __future__ import annotations import os import tempfile from pathlib import Path from config import TestingConfig PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent STATIC = PROJECT_ROOT / "static" class ZootechTestConfig(TestingConfig): _TMP_DIR = tempfile.mkdtemp(prefix="wesp-zootech-test-") SQLALCHEMY_DATABASE_URI = f"sqlite:///{os.path.join(_TMP_DIR, 'zootech_test.db')}" SQLALCHEMY_BINDS = {"reports": f"sqlite:///{os.path.join(_TMP_DIR, 'reports_test.db')}"} AUTH_LOGIN = "zootech-test-admin" AUTH_PASSWORD = "zootech-test-secret" def drain_response(resp) -> None: try: resp.get_data() finally: close = getattr(resp, "close", None) if callable(close): close()