]> git.openstreetmap.org Git - nominatim.git/blob - test/python/test_tools_refresh.py
adapt tests for new word count mechanism
[nominatim.git] / test / python / test_tools_refresh.py
1 """
2 Test for various refresh functions.
3 """
4 from pathlib import Path
5
6 import pytest
7
8 from nominatim.tools import refresh
9
10 def test_refresh_import_wikipedia_not_existing(dsn):
11     assert refresh.import_wikipedia_articles(dsn, Path('.')) == 1
12
13
14 @pytest.mark.parametrize("replace", (True, False))
15 def test_refresh_import_wikipedia(dsn, src_dir, table_factory, temp_db_cursor, replace):
16     if replace:
17         table_factory('wikipedia_article')
18         table_factory('wikipedia_redirect')
19
20     # use the small wikipedia file for the API testdb
21     assert refresh.import_wikipedia_articles(dsn, src_dir / 'test' / 'testdb') == 0
22
23     assert temp_db_cursor.table_rows('wikipedia_article') > 0
24     assert temp_db_cursor.table_rows('wikipedia_redirect') > 0