补充测试覆盖:认证、云图、管理后台、资料、收藏、云类型模块共 78 个测试用例
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user