X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/54d35ddfe9054f3bc49896fc47c2a02b3fc43066..9ec26c60ff1c9b5b259ecb7ef16ad0bacbc3174b:/test/python/cli/test_cmd_admin.py diff --git a/test/python/cli/test_cmd_admin.py b/test/python/cli/test_cmd_admin.py index f8b6d76d..0fe6e327 100644 --- a/test/python/cli/test_cmd_admin.py +++ b/test/python/cli/test_cmd_admin.py @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2022 by the Nominatim developer community. +# For a full list of authors see the git log. """ Test for the command line interface wrapper admin subcommand. @@ -13,17 +19,6 @@ import nominatim.tools.migration import nominatim.clicmd.admin -@pytest.mark.parametrize("params", [('--warm', ), - ('--warm', '--reverse-only'), - ('--warm', '--search-only')]) -def test_admin_command_legacy(cli_call, mock_func_factory, params): - mock_run_legacy = mock_func_factory(nominatim.clicmd.admin, 'run_legacy_script') - - assert cli_call('admin', *params) == 0 - - assert mock_run_legacy.called == 1 - - def test_admin_command_check_database(cli_call, mock_func_factory): mock = mock_func_factory(nominatim.tools.check_database, 'check_database') @@ -38,6 +33,18 @@ def test_admin_migrate(cli_call, mock_func_factory): assert mock.called == 1 +def test_admin_clean_deleted_relations(cli_call, mock_func_factory): + mock = mock_func_factory(nominatim.tools.admin, 'clean_deleted_relations') + + assert cli_call('admin', '--clean-deleted', '--age', '1 month') == 0 + assert mock.called == 1 + +def test_admin_clean_deleted_relations_no_age(cli_call, mock_func_factory): + mock = mock_func_factory(nominatim.tools.admin, 'clean_deleted_relations') + + with pytest.raises(SystemExit): + cli_call('admin', '--clean-deleted') + class TestCliAdminWithDb: @pytest.fixture(autouse=True)