X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4cb6dc01f382e9fb748efbe4517442af2274f210..a33f2c0f5ba43df533b6e137f9151fe67feb20a1:/test/python/test_tools_replication.py diff --git a/test/python/test_tools_replication.py b/test/python/test_tools_replication.py index b94563ff..affe1317 100644 --- a/test/python/test_tools_replication.py +++ b/test/python/test_tools_replication.py @@ -9,6 +9,7 @@ from osmium.replication.server import OsmosisState import nominatim.tools.replication import nominatim.db.status as status +from nominatim.errors import UsageError OSM_NODE_DATA = """\ @@ -24,7 +25,7 @@ def test_init_replication_bad_base_url(monkeypatch, status_table, place_row, tem monkeypatch.setattr(nominatim.db.status, "get_url", lambda u : OSM_NODE_DATA) - with pytest.raises(RuntimeError, match="Failed to reach replication service"): + with pytest.raises(UsageError, match="Failed to reach replication service"): nominatim.tools.replication.init_replication(temp_db_conn, 'https://test.io') @@ -40,7 +41,8 @@ def test_init_replication_success(monkeypatch, status_table, place_row, temp_db_ temp_db_cursor.execute("SELECT * FROM import_status") - expected_date = dt.datetime.fromisoformat('2006-01-27T19:09:10').replace(tzinfo=dt.timezone.utc) + expected_date = dt.datetime.strptime('2006-01-27T19:09:10', status.ISODATE_FORMAT)\ + .replace(tzinfo=dt.timezone.utc) assert temp_db_cursor.rowcount == 1 assert temp_db_cursor.fetchone() == [expected_date, 234, True] @@ -90,7 +92,7 @@ def update_options(tmpdir): max_diff_size=1) def test_update_empty_status_table(status_table, temp_db_conn): - with pytest.raises(RuntimeError): + with pytest.raises(UsageError): nominatim.tools.replication.update(temp_db_conn, {})