fix(agent): quote DSN values and drop deprecated testcontainers import
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user