feat: 用安装页和编排完成部署,并整理登录页

This commit is contained in:
2026-10-30 09:49:20 +08:00
parent 7ed299bbf6
commit 3fa4f83180
30 changed files with 635 additions and 121 deletions
+13 -9
View File
@@ -1,17 +1,17 @@
from __future__ import annotations
import os
import shutil
import time
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
os.environ["DECOM_DATABASE_URL"] = "sqlite+pysqlite:///" + (Path(__file__).resolve().parents[1] / "data" / "test.db").as_posix()
TEST_DATA = Path(__file__).resolve().parents[1] / "data" / "pytest"
os.environ["DECOM_DATA_DIR"] = str(TEST_DATA)
os.environ["DECOM_ALLOW_SQLITE"] = "1"
os.environ["DECOM_INLINE_WORKER"] = "1"
os.environ["DECOM_ADMIN_USERNAME"] = "admin"
os.environ["DECOM_ADMIN_PASSWORD"] = "admin-pass"
os.environ["DECOM_JWT_SECRET"] = "test-secret"
from app.collect.io import parse_csv, write_csv # noqa: E402
from app.db import reset_engine # noqa: E402
@@ -27,16 +27,20 @@ PUBLIC_KEY = (
@pytest.fixture()
def client():
database = Path(os.environ["DECOM_DATABASE_URL"].removeprefix("sqlite+pysqlite:///"))
if database.exists():
database.unlink()
if TEST_DATA.exists():
shutil.rmtree(TEST_DATA)
reset_engine()
application = create_app()
with TestClient(application) as test_client:
created = test_client.post(
"/api/install",
json={"sqlite": True, "adminUsername": "admin", "adminPassword": "admin-pass", "separateWorker": False},
)
assert created.status_code == 200
yield test_client
reset_engine()
if database.exists():
database.unlink()
if TEST_DATA.exists():
shutil.rmtree(TEST_DATA)
def test_period_bounds():