refactor(storage): route project DSNs and remove legacy backends

This commit is contained in:
2026-08-18 18:29:09 +08:00
parent b21eaffe40
commit 6b09662de6
51 changed files with 542 additions and 10951 deletions
@@ -6,7 +6,10 @@ from uuid import uuid4
import pytest
from cryptography.fernet import InvalidToken
from app.infra.db.metadb.repositories.metadata_repository import MetadataRepository
from app.infra.db.metadb.repositories.metadata_repository import (
MetadataRepository,
_normalize_postgres_dsn,
)
class _DummyResult:
@@ -124,6 +127,12 @@ def test_encrypted_dsn_decrypts_without_migration(monkeypatch):
session.commit.assert_not_awaited()
def test_psycopg_sqlalchemy_dsn_is_normalized_for_direct_psycopg_clients():
assert _normalize_postgres_dsn(
"postgresql+psycopg://user:secret@db.example/project"
) == "postgresql://user:secret@db.example/project"
def test_upsert_project_database_config_encrypts_plaintext_dsn(monkeypatch):
project_id = uuid4()
session = SimpleNamespace(