数据库创建

This commit is contained in:
2025-06-22 19:26:23 +08:00
parent 6094d8219e
commit f6825b670f
31 changed files with 1494 additions and 270 deletions

23
tests/test_main.py Normal file
View File

@@ -0,0 +1,23 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_read_main():
from pkg.conf.appmeta import BackendVersion
import uuid
response = client.get("/api/site/ping")
json_response = response.json()
assert response.status_code == 200
assert json_response['code'] == 0
assert json_response['data'] == BackendVersion
assert json_response['msg'] is None
assert 'instance_id' in json_response
try:
uuid.UUID(json_response['instance_id'], version=4)
except (ValueError, TypeError):
assert False, f"instance_id is not a valid UUID4: {json_response['instance_id']}"