feat(deploy): 接入生产密钥与数据库迁移
Deploy Production / deploy (push) Successful in 1m42s

This commit is contained in:
yuxuanhui
2026-08-05 22:45:57 +08:00
parent d7d5ed8979
commit afdc5ca909
9 changed files with 139 additions and 33 deletions
@@ -0,0 +1,26 @@
import pytest
from zhixing_server.bootstrap.config import sqlalchemy_database_url
def test_sqlalchemy_url_adds_psycopg_driver_and_preserves_query() -> None:
database_url = (
"postgresql://zhixing-system@1Panel-postgresql-5Fc7:5432/zhixing-system"
"?sslmode=require&connect_timeout=5"
)
assert sqlalchemy_database_url(database_url) == (
"postgresql+psycopg://zhixing-system@1Panel-postgresql-5Fc7:5432/zhixing-system"
"?sslmode=require&connect_timeout=5"
)
def test_sqlalchemy_url_does_not_duplicate_psycopg_driver() -> None:
database_url = "postgresql+psycopg://user@localhost:5432/db?sslmode=disable"
assert sqlalchemy_database_url(database_url) == database_url
def test_sqlalchemy_url_rejects_non_postgresql_scheme() -> None:
with pytest.raises(ValueError, match="postgresql"):
sqlalchemy_database_url("mysql://user@localhost/db")