补充测试覆盖:认证、云图、管理后台、资料、收藏、云类型模块共 78 个测试用例

This commit is contained in:
2026-07-26 01:16:17 +08:00
parent 77bf076ad0
commit 6b1f0d5f5f
7 changed files with 1288 additions and 0 deletions
+12
View File
@@ -1,4 +1,5 @@
import asyncio
import io
import os
import shutil
import tempfile
@@ -8,12 +9,23 @@ from pathlib import Path
import pytest
from fastapi.testclient import TestClient
from PIL import Image
TEST_ID = uuid.uuid4().hex
TEST_DB = Path(tempfile.gettempdir()) / f"opencloud-{TEST_ID}.sqlite3"
TEST_UPLOADS = Path(tempfile.gettempdir()) / f"opencloud-{TEST_ID}-uploads"
def bearer(token: str) -> dict[str, str]:
return {"Authorization": f"Bearer {token}"}
def png_bytes() -> bytes:
output = io.BytesIO()
Image.new("RGB", (200, 200), color=(125, 196, 240)).save(output, format="PNG")
return output.getvalue()
os.environ["ENVIRONMENT"] = "test"
os.environ["DATABASE_URL"] = f"sqlite+aiosqlite:///{TEST_DB}"
os.environ["SECRET_KEY"] = "test-secret-key-that-is-long-enough-for-opencloud"