]> git.openstreetmap.org Git - nominatim.git/blob - test/python/test_tools_refresh.py
add a function for the intial indexing run
[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 TEST_DIR = (Path(__file__) / '..' / '..').resolve()
11
12 def test_refresh_import_wikipedia_not_existing(dsn):
13     assert 1 == refresh.import_wikipedia_articles(dsn, Path('.'))
14
15
16 @pytest.mark.parametrize("replace", (True, False))
17 def test_refresh_import_wikipedia(dsn, table_factory, temp_db_cursor, replace):
18     if replace:
19         table_factory('wikipedia_article')
20         table_factory('wikipedia_redirect')
21
22     # use the small wikipedia file for the API testdb
23     assert 0 == refresh.import_wikipedia_articles(dsn, TEST_DIR / 'testdb')
24
25     assert temp_db_cursor.scalar('SELECT count(*) FROM wikipedia_article') > 0
26     assert temp_db_cursor.scalar('SELECT count(*) FROM wikipedia_redirect') > 0