mock_func_factory(nominatim.data.country_info, 'setup_country_tables'),
mock_func_factory(nominatim.tools.database_import, 'import_osm_data'),
mock_func_factory(nominatim.tools.refresh, 'import_wikipedia_articles'),
- mock_func_factory(nominatim.tools.refresh, 'import_osm_views_geotiff'),
+ mock_func_factory(nominatim.tools.refresh, 'import_secondary_importance'),
mock_func_factory(nominatim.tools.database_import, 'truncate_data_tables'),
mock_func_factory(nominatim.tools.database_import, 'load_data'),
mock_func_factory(nominatim.tools.database_import, 'create_tables'),
@pytest.mark.parametrize("command,func", [
('address-levels', 'load_address_levels_from_config'),
('wiki-data', 'import_wikipedia_articles'),
- ('osm-views', 'import_osm_views_geotiff'),
('importance', 'recompute_importance'),
('website', 'setup_website'),
])
assert self.call_nominatim('refresh', '--wiki-data') == 1
- def test_refresh_osm_views_geotiff_file_not_found(self):
- assert self.call_nominatim('refresh', '--osm-views') == 1
+ def test_refresh_secondary_importance_file_not_found(self):
+ assert self.call_nominatim('refresh', '--secondary-importance') == 1
+
+
+ def test_refresh_secondary_importance_new_table(self, mock_func_factory):
+ mocks = [mock_func_factory(nominatim.tools.refresh, 'import_secondary_importance'),
+ mock_func_factory(nominatim.tools.refresh, 'create_functions')]
+
+ assert self.call_nominatim('refresh', '--secondary-importance') == 0
+ assert mocks[0].called == 1
+ assert mocks[1].called == 1
+
def test_refresh_importance_computed_after_wiki_import(self, monkeypatch):
calls = []
assert refresh.import_wikipedia_articles(dsn, Path('.')) == 1
-def test_refresh_import_osm_views_geotiff_not_existing(dsn):
- assert refresh.import_osm_views_geotiff(dsn, Path('.')) == 1
+def test_refresh_import_secondary_importance_non_existing(dsn):
+ assert refresh.import_secondary_importance(dsn, Path('.')) == 1
+
+def test_refresh_import_secondary_importance_testdb(dsn, src_dir, temp_db_conn, temp_db_cursor):
+ temp_db_cursor.execute('CREATE EXTENSION postgis; CREATE EXTENSION postgis_raster')
+ assert refresh.import_secondary_importance(dsn, src_dir / 'test' / 'testdb') == 0
+
+ assert temp_db_conn.table_exists('secondary_importance')
@pytest.mark.parametrize("replace", (True, False))