X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9d83da830f349b746c72b1df2a7526d517552b72..8b8dfc46ebee5f78a91685dc83dc9382d21aad0e:/test/python/test_cli.py diff --git a/test/python/test_cli.py b/test/python/test_cli.py index f4271259..1d89ec69 100644 --- a/test/python/test_cli.py +++ b/test/python/test_cli.py @@ -255,10 +255,27 @@ def test_index_command(mock_func_factory, temp_db_cursor, tokenizer_mock, assert bnd_mock.called == do_bnds assert rank_mock.called == do_ranks -def test_special_phrases_command(temp_db, mock_func_factory, tokenizer_mock): +@pytest.mark.parametrize("no_replace", [(True), (False)]) +def test_special_phrases_wiki_command(temp_db, mock_func_factory, tokenizer_mock, no_replace): func = mock_func_factory(nominatim.clicmd.special_phrases.SPImporter, 'import_phrases') - call_nominatim('special-phrases', '--import-from-wiki') + if no_replace: + call_nominatim('special-phrases', '--import-from-wiki', '--no-replace') + else: + call_nominatim('special-phrases', '--import-from-wiki') + + assert func.called == 1 + +@pytest.mark.parametrize("no_replace", [(True), (False)]) +def test_special_phrases_csv_command(temp_db, mock_func_factory, tokenizer_mock, no_replace): + func = mock_func_factory(nominatim.clicmd.special_phrases.SPImporter, 'import_phrases') + testdata = SRC_DIR / 'test' / 'testdb' + csv_path = str((testdata / 'full_en_phrases_test.csv').resolve()) + + if no_replace: + call_nominatim('special-phrases', '--import-from-csv', csv_path, '--no-replace') + else: + call_nominatim('special-phrases', '--import-from-csv', csv_path) assert func.called == 1