X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e1c5673ac31831e1b0cca58e21ebe6622c372ea7..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 d4f8290f..b95e6ede 100644 --- a/test/python/test_cli_replication.py +++ b/test/python/test_cli_replication.py @@ -26,6 +26,28 @@ def call_nominatim(*args): config_dir=str(SRC_DIR / 'settings'), cli_args=['replication'] + list(args)) +@pytest.fixture +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()