File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55import pytest
66
7- from argus import config , health
7+ from argus import config , database , health
8+
9+
10+ def test_create_db_engine_rounds_postgresql_connect_timeout (monkeypatch ):
11+ """Configure PostgreSQL's integer timeout without opening a connection."""
12+ captured = {}
13+
14+ def fake_create_engine (database_url , ** kwargs ):
15+ captured ["database_url" ] = database_url
16+ captured .update (kwargs )
17+ return object ()
18+
19+ monkeypatch .setattr (database , "create_engine" , fake_create_engine )
20+
21+ database .create_db_engine ("postgresql+psycopg://user:pass@db/argus" , 1.2 )
22+
23+ assert captured == {
24+ "database_url" : "postgresql+psycopg://user:pass@db/argus" ,
25+ "connect_args" : {"connect_timeout" : 2 },
26+ }
827
928
1029def test_check_database_succeeds_with_sqlite_url (tmp_path , monkeypatch ):
You can’t perform that action at this time.
0 commit comments