feat: 核心服务端基础框架(身份/平台 API)

- 七端口 RBAC、select-identity、JWT、审计
- FastAPI + SQLAlchemy + SQLite,/auth /opc /admin /agents 等路由
This commit is contained in:
2026-08-23 22:35:59 +08:00
commit 26fa546f67
39 changed files with 8354 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""共享夹具:临时 SQLite 数据库 + TestClientauth 与 rbac 测试共用)。"""
from __future__ import annotations
import pytest
from fastapi.testclient import TestClient
from app.main import app
from app.repositories import Database
@pytest.fixture()
def client(tmp_path):
"""把 app.state.db 换成指向临时 SQLite 的 Database,保证测试隔离。"""
db = Database(db_url=f"sqlite:///{tmp_path}/test.db")
db.initialize()
app.state.db = db
with TestClient(app) as c:
yield c
db.close()