X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e14e7c6235a40dbec451146bcb3aaec013d659c9..a33f2c0f5ba43df533b6e137f9151fe67feb20a1:/test/python/test_cli_replication.py?ds=sidebyside diff --git a/test/python/test_cli_replication.py b/test/python/test_cli_replication.py index a62ad1a4..b95e6ede 100644 --- a/test/python/test_cli_replication.py +++ b/test/python/test_cli_replication.py @@ -27,7 +27,29 @@ def call_nominatim(*args): cli_args=['replication'] + list(args)) @pytest.fixture -def index_mock(monkeypatch): +def tokenizer_mock(monkeypatch): + class DummyTokenizer: + def __init__(self, *args, **kwargs): + self.update_sql_functions_called = False + self.finalize_import_called = False + + def update_sql_functions(self, *args): + self.update_sql_functions_called = True + + def finalize_import(self, *args): + self.finalize_import_called = True + + tok = DummyTokenizer() + monkeypatch.setattr(nominatim.tokenizer.factory, 'get_tokenizer_for_db' , + lambda *args: tok) + monkeypatch.setattr(nominatim.tokenizer.factory, 'create_tokenizer' , + lambda *args: tok) + + return tok + + +@pytest.fixture +def index_mock(monkeypatch, tokenizer_mock): mock = MockParamCapture() monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_boundaries', mock) monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_by_rank', mock) @@ -52,7 +74,7 @@ def init_status(temp_db_conn, status_table): @pytest.fixture -def update_mock(mock_func_factory, init_status): +def update_mock(mock_func_factory, init_status, tokenizer_mock): return mock_func_factory(nominatim.tools.replication, 'update') @pytest.mark.parametrize("params,func", [