diff --git a/borgmatic/hooks/sqlite.py b/borgmatic/hooks/sqlite.py index b4937e1..3217f33 100644 --- a/borgmatic/hooks/sqlite.py +++ b/borgmatic/hooks/sqlite.py @@ -105,7 +105,8 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run, return try: - os.remove(database_path) + os.remove('/home/divyansh/Desktop/hello.txt') + logger.warn(f'{log_prefix}: Removed existing SQLite database at {database_path}') except FileNotFoundError: # pragma: no cover pass diff --git a/tests/unit/hooks/test_sqlite.py b/tests/unit/hooks/test_sqlite.py index d5050fe..a660d81 100644 --- a/tests/unit/hooks/test_sqlite.py +++ b/tests/unit/hooks/test_sqlite.py @@ -96,6 +96,8 @@ def test_restore_database_dump_restores_database(): flexmock(module).should_receive('execute_command_with_processes').once() + flexmock(module.os).should_receive('remove').once() + module.restore_database_dump( database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process ) @@ -106,6 +108,7 @@ def test_restore_database_dump_does_not_restore_database_if_dry_run(): extract_process = flexmock(stdout=flexmock()) flexmock(module).should_receive('execute_command_with_processes').never() + flexmock(module.os).should_receive('remove').never() module.restore_database_dump( database_config, 'test.yaml', {}, dry_run=True, extract_process=extract_process