fix(agent): quote DSN values and drop deprecated testcontainers import

This commit is contained in:
2026-08-23 16:58:30 -05:00
parent b5ed0f73b9
commit 207cdb0ef5
3 changed files with 30 additions and 4 deletions
+22
View File
@@ -37,3 +37,25 @@ def test_sync_runs_rejects_bad_status(cfg):
"INSERT INTO sync_runs (connector, started_at, status)"
" VALUES ('x', now(), 'bogus')"
)
def test_agent_dsn_escapes_password_with_space_and_quote():
import psycopg
from agent.config import AgentConfig
from agent.db import agent_dsn
cfg = AgentConfig(
db_host="localhost",
db_port=5432,
db_user="testuser",
db_password="pa ss'word", # password with space and single quote
agent_db_name="testdb",
firefly_url="http://firefly.test",
firefly_token="test-token",
heartbeat_interval_minutes=60,
)
dsn = agent_dsn(cfg)
# Parse DSN and verify password is preserved correctly
parsed = psycopg.conninfo.conninfo_to_dict(dsn)
assert parsed["password"] == "pa ss'word"