fix(T+): 补齐指导成本与读取服务保护
补充业务详情指导成本入口、来源版本和历史封存保护,接入月份锁并完善权限复核。 同步接入读取服务运行状态到页面,补充前端控制、回归测试和服务端只读连接授权校验。 定向隔离测试:89 项通过,1 条既有 Starlette 弃用警告。
This commit is contained in:
1 parent
68e70fd6e2
commit
b8920c0d28
17 files changed
+375
-47
No files matched your search
@@ -13,9 +13,10 @@ pytestmark = pytest.mark.integration
|
||||
BASE = "/api/v1/system/tplus"
|
||||
|
||||
|
||||
def test_新增配置表迁移可往返且不修改同步批次():
|
||||
def test_不可逆迁移拒绝回退且不修改同步批次():
|
||||
from alembic import command
|
||||
from alembic.config import Config
|
||||
from alembic.script import ScriptDirectory
|
||||
from sqlalchemy import inspect, text
|
||||
|
||||
from app.core.db import get_engine
|
||||
@@ -25,12 +26,12 @@ def test_新增配置表迁移可往返且不修改同步批次():
|
||||
with engine.connect() as connection:
|
||||
before = connection.exec_driver_sql('SELECT COUNT(*) FROM tplus_sync_batches').scalar_one()
|
||||
config = Config(str(Path(__file__).resolve().parents[2] / "alembic.ini"))
|
||||
command.downgrade(config, "26e7f8a9b0c1")
|
||||
assert not inspect(engine).has_table("tplus_automation_configs")
|
||||
with pytest.raises(RuntimeError, match="不可直接回退"):
|
||||
command.downgrade(config, "26e7f8a9b0c1")
|
||||
command.upgrade(config, "head")
|
||||
assert inspect(engine).has_table("tplus_automation_configs")
|
||||
with engine.connect() as connection:
|
||||
assert connection.execute(text('SELECT version_num FROM alembic_version')).scalar_one() == '28a9b0c1d2e3'
|
||||
assert connection.execute(text('SELECT version_num FROM alembic_version')).scalar_one() == ScriptDirectory.from_config(config).get_current_head()
|
||||
assert connection.exec_driver_sql('SELECT COUNT(*) FROM tplus_sync_batches').scalar_one() == before
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user