]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_cli.py
Add tests for the new SPWikiLoader and SPCsvLoader
[nominatim.git] / test / python / test_cli.py
index c43dce3b4879a180b80a59e19f99d950ca9218e3..9810aee756b63d9b4d0158673a4e20b2c3c5db08 100644 (file)
@@ -255,13 +255,21 @@ 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):
-    func = mock_func_factory(nominatim.clicmd.special_phrases.SPImporter, 'import_from_wiki')
+def test_special_phrases_wiki_command(temp_db, mock_func_factory, tokenizer_mock):
+    func = mock_func_factory(nominatim.clicmd.special_phrases.SPImporter, 'import_phrases')
 
     call_nominatim('special-phrases', '--import-from-wiki')
 
     assert func.called == 1
 
+def test_special_phrases_csv_command(temp_db, mock_func_factory, tokenizer_mock):
+    func = mock_func_factory(nominatim.clicmd.special_phrases.SPImporter, 'import_phrases')
+    testdata = Path('__file__') / '..' / '..' / 'testdb'
+    csv_path = str((testdata / 'full_en_phrases_test.csv').resolve())
+    call_nominatim('special-phrases', '--import-from-csv', csv_path)
+
+    assert func.called == 1
+
 @pytest.mark.parametrize("command,func", [
                          ('postcodes', 'update_postcodes'),
                          ('word-counts', 'recompute_word_counts'),