mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
more testing for refresh functions
This commit is contained in:
@@ -22,3 +22,14 @@ def test_refresh_import_wikipedia(dsn, src_dir, table_factory, temp_db_cursor, r
|
|||||||
|
|
||||||
assert temp_db_cursor.table_rows('wikipedia_article') > 0
|
assert temp_db_cursor.table_rows('wikipedia_article') > 0
|
||||||
assert temp_db_cursor.table_rows('wikipedia_redirect') > 0
|
assert temp_db_cursor.table_rows('wikipedia_redirect') > 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_recompute_importance(placex_table, table_factory, temp_db_conn, temp_db_cursor):
|
||||||
|
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION compute_importance(extratags HSTORE,
|
||||||
|
country_code varchar(2),
|
||||||
|
osm_type varchar(1), osm_id BIGINT,
|
||||||
|
OUT importance FLOAT,
|
||||||
|
OUT wikipedia TEXT)
|
||||||
|
AS $$ SELECT 0.1, 'foo' $$ LANGUAGE SQL""")
|
||||||
|
|
||||||
|
refresh.recompute_importance(temp_db_conn)
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ def run_website_script(tmp_path, project_env, temp_db_conn):
|
|||||||
return _runner
|
return _runner
|
||||||
|
|
||||||
|
|
||||||
|
def test_basedir_created(tmp_path, project_env, temp_db_conn):
|
||||||
|
webdir = tmp_path / 'website'
|
||||||
|
|
||||||
|
assert not webdir.exists()
|
||||||
|
|
||||||
|
refresh.setup_website(webdir, project_env, temp_db_conn)
|
||||||
|
|
||||||
|
assert webdir.exists()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("setting,retval", (('yes', 10), ('no', 20)))
|
@pytest.mark.parametrize("setting,retval", (('yes', 10), ('no', 20)))
|
||||||
def test_setup_website_check_bool(monkeypatch, test_script, run_website_script,
|
def test_setup_website_check_bool(monkeypatch, test_script, run_website_script,
|
||||||
setting, retval):
|
setting, retval):
|
||||||
@@ -69,3 +79,13 @@ def test_setup_website_check_str(monkeypatch, test_script, run_website_script):
|
|||||||
test_script('exit(CONST_Default_Language === "ffde 2" ? 10 : 20);')
|
test_script('exit(CONST_Default_Language === "ffde 2" ? 10 : 20);')
|
||||||
|
|
||||||
assert run_website_script() == 10
|
assert run_website_script() == 10
|
||||||
|
|
||||||
|
|
||||||
|
def test_relative_log_file(project_env, monkeypatch, test_script, run_website_script):
|
||||||
|
monkeypatch.setenv('NOMINATIM_LOG_FILE', 'access.log')
|
||||||
|
|
||||||
|
expected_file = str(project_env.project_dir / 'access.log')
|
||||||
|
test_script(f'exit(CONST_Log_File === "{expected_file}" ? 10 : 20);')
|
||||||
|
|
||||||
|
assert run_website_script() == 10
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user