"""Интеграционные тесты HTTP-эндпоинтов (Flask test client).""" import pytest @pytest.fixture def client(tmp_path, monkeypatch): from db import connection as conn monkeypatch.setattr(conn, "DB_PATH", str(tmp_path / "app.db")) from app import create_app app = create_app() app.config["TESTING"] = True yield app.test_client() c = getattr(conn._local, "conn", None) if c is not None: try: c.close() except Exception: pass conn._local.conn = None class TestHealth: def test_health(self, client): from config import VERSION r = client.get("/health") assert r.status_code == 200 data = r.get_json() assert data["ok"] is True assert data["version"] == VERSION class TestHomepage: def test_version_and_asset_urls_use_application_version(self, client): from config import VERSION response = client.get("/") assert response.status_code == 200 html = response.get_data(as_text=True) assert f">v{VERSION}" in html assert f"/static/files.js?v={VERSION}" in html assert f"/file-picker/file-picker.iife.js?v={VERSION}" in html assert '