From ec9def4e71a98d876fdfdbbbe718b8965452491e Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Sun, 26 Mar 2023 23:52:25 +0530 Subject: [PATCH] rename repository arg to repository_path in all borg actions --- borgmatic/borg/borg.py | 6 +- borgmatic/borg/break_lock.py | 4 +- borgmatic/borg/check.py | 10 ++-- borgmatic/borg/compact.py | 6 +- borgmatic/borg/create.py | 12 ++-- borgmatic/borg/export_tar.py | 6 +- borgmatic/borg/extract.py | 8 ++- borgmatic/borg/flags.py | 10 ++-- borgmatic/borg/info.py | 4 +- borgmatic/borg/list.py | 31 +++++----- borgmatic/borg/mount.py | 8 +-- borgmatic/borg/prune.py | 4 +- borgmatic/borg/rcreate.py | 10 ++-- borgmatic/borg/rinfo.py | 4 +- borgmatic/borg/rlist.py | 24 +++++--- borgmatic/borg/transfer.py | 4 +- tests/unit/borg/test_borg.py | 43 +++++++++----- tests/unit/borg/test_break_lock.py | 12 ++-- tests/unit/borg/test_check.py | 28 ++++----- tests/unit/borg/test_compact.py | 30 ++++++---- tests/unit/borg/test_create.py | 92 +++++++++++++++--------------- tests/unit/borg/test_export_tar.py | 26 ++++----- tests/unit/borg/test_extract.py | 14 ++--- tests/unit/borg/test_flags.py | 10 ++-- tests/unit/borg/test_info.py | 24 ++++---- tests/unit/borg/test_list.py | 58 +++++++++---------- tests/unit/borg/test_mount.py | 22 +++---- tests/unit/borg/test_prune.py | 22 +++---- tests/unit/borg/test_rcreate.py | 30 +++++----- tests/unit/borg/test_rinfo.py | 20 +++---- tests/unit/borg/test_rlist.py | 30 +++++----- tests/unit/borg/test_transfer.py | 24 ++++---- 32 files changed, 339 insertions(+), 297 deletions(-) diff --git a/borgmatic/borg/borg.py b/borgmatic/borg/borg.py index 460d9d6..f19d655 100644 --- a/borgmatic/borg/borg.py +++ b/borgmatic/borg/borg.py @@ -13,7 +13,7 @@ BORG_SUBCOMMANDS_WITHOUT_REPOSITORY = (('debug', 'info'), ('debug', 'convert-pro def run_arbitrary_borg( - repository, + repository_path, storage_config, local_borg_version, options, @@ -44,10 +44,10 @@ def run_arbitrary_borg( repository_archive_flags = () elif archive: repository_archive_flags = flags.make_repository_archive_flags( - repository, archive, local_borg_version + repository_path, archive, local_borg_version ) else: - repository_archive_flags = flags.make_repository_flags(repository, local_borg_version) + repository_archive_flags = flags.make_repository_flags(repository_path, local_borg_version) full_command = ( (local_path,) diff --git a/borgmatic/borg/break_lock.py b/borgmatic/borg/break_lock.py index 820b1c5..2dff31e 100644 --- a/borgmatic/borg/break_lock.py +++ b/borgmatic/borg/break_lock.py @@ -7,7 +7,7 @@ logger = logging.getLogger(__name__) def break_lock( - repository, storage_config, local_borg_version, local_path='borg', remote_path=None, + repository_path, storage_config, local_borg_version, local_path='borg', remote_path=None, ): ''' Given a local or remote repository path, a storage configuration dict, the local Borg version, @@ -24,7 +24,7 @@ def break_lock( + (('--lock-wait', str(lock_wait)) if lock_wait else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) borg_environment = environment.make_environment(storage_config) diff --git a/borgmatic/borg/check.py b/borgmatic/borg/check.py index 2914d83..993a3c0 100644 --- a/borgmatic/borg/check.py +++ b/borgmatic/borg/check.py @@ -243,7 +243,7 @@ def read_check_time(path): def check_archives( - repository, + repository_path, location_config, storage_config, consistency_config, @@ -268,7 +268,7 @@ def check_archives( try: borg_repository_id = json.loads( rinfo.display_repository_info( - repository, + repository_path, storage_config, local_borg_version, argparse.Namespace(json=True), @@ -277,7 +277,7 @@ def check_archives( ) )['repository']['id'] except (json.JSONDecodeError, KeyError): - raise ValueError(f'Cannot determine Borg repository ID for {repository}') + raise ValueError(f'Cannot determine Borg repository ID for {repository_path}') checks = filter_checks_on_frequency( location_config, @@ -310,7 +310,7 @@ def check_archives( + verbosity_flags + (('--progress',) if progress else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) borg_environment = environment.make_environment(storage_config) @@ -329,6 +329,6 @@ def check_archives( if 'extract' in checks: extract.extract_last_archive_dry_run( - storage_config, local_borg_version, repository, lock_wait, local_path, remote_path + storage_config, local_borg_version, repository_path, lock_wait, local_path, remote_path ) write_check_time(make_check_time_path(location_config, borg_repository_id, 'extract')) diff --git a/borgmatic/borg/compact.py b/borgmatic/borg/compact.py index 847ed26..0e9d3e8 100644 --- a/borgmatic/borg/compact.py +++ b/borgmatic/borg/compact.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) def compact_segments( dry_run, - repository, + repository_path, storage_config, local_borg_version, local_path='borg', @@ -36,11 +36,11 @@ def compact_segments( + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) if dry_run: - logging.info(f'{repository}: Skipping compact (dry run)') + logging.info(f'{repository_path}: Skipping compact (dry run)') return execute_command( diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index d557a6a..58c3509 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -322,7 +322,7 @@ def check_all_source_directories_exist(source_directories): def create_archive( dry_run, - repository, + repository_path, location_config, storage_config, local_borg_version, @@ -411,7 +411,7 @@ def create_archive( if stream_processes and location_config.get('read_special') is False: logger.warning( - f'{repository}: Ignoring configured "read_special" value of false, as true is needed for database hooks.' + f'{repository_path}: Ignoring configured "read_special" value of false, as true is needed for database hooks.' ) create_command = ( @@ -446,7 +446,9 @@ def create_archive( ) + (('--dry-run',) if dry_run else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) - + flags.make_repository_archive_flags(repository, archive_name_format, local_borg_version) + + flags.make_repository_archive_flags( + repository_path, archive_name_format, local_borg_version + ) + (sources if not pattern_file else ()) ) @@ -466,7 +468,7 @@ def create_archive( # If database hooks are enabled (as indicated by streaming processes), exclude files that might # cause Borg to hang. But skip this if the user has explicitly set the "read_special" to True. if stream_processes and not location_config.get('read_special'): - logger.debug(f'{repository}: Collecting special file paths') + logger.debug(f'{repository_path}: Collecting special file paths') special_file_paths = collect_special_file_paths( create_command, local_path, @@ -477,7 +479,7 @@ def create_archive( if special_file_paths: logger.warning( - f'{repository}: Excluding special files to prevent Borg from hanging: {", ".join(special_file_paths)}' + f'{repository_path}: Excluding special files to prevent Borg from hanging: {", ".join(special_file_paths)}' ) exclude_file = write_pattern_file( expand_home_directories( diff --git a/borgmatic/borg/export_tar.py b/borgmatic/borg/export_tar.py index 01d1b7e..2b427f0 100644 --- a/borgmatic/borg/export_tar.py +++ b/borgmatic/borg/export_tar.py @@ -9,7 +9,7 @@ logger = logging.getLogger(__name__) def export_tar_archive( dry_run, - repository, + repository_path, archive, paths, destination_path, @@ -45,7 +45,7 @@ def export_tar_archive( + (('--dry-run',) if dry_run else ()) + (('--tar-filter', tar_filter) if tar_filter else ()) + (('--strip-components', str(strip_components)) if strip_components else ()) - + flags.make_repository_archive_flags(repository, archive, local_borg_version,) + + flags.make_repository_archive_flags(repository_path, archive, local_borg_version,) + (destination_path,) + (tuple(paths) if paths else ()) ) @@ -56,7 +56,7 @@ def export_tar_archive( output_log_level = logging.INFO if dry_run: - logging.info(f'{repository}: Skipping export to tar file (dry run)') + logging.info(f'{repository_path}: Skipping export to tar file (dry run)') return execute_command( diff --git a/borgmatic/borg/extract.py b/borgmatic/borg/extract.py index 6c32f7f..a95685c 100644 --- a/borgmatic/borg/extract.py +++ b/borgmatic/borg/extract.py @@ -11,7 +11,7 @@ logger = logging.getLogger(__name__) def extract_last_archive_dry_run( storage_config, local_borg_version, - repository, + repository_path, lock_wait=None, local_path='borg', remote_path=None, @@ -30,7 +30,7 @@ def extract_last_archive_dry_run( try: last_archive_name = rlist.resolve_archive_name( - repository, 'latest', storage_config, local_borg_version, local_path, remote_path + repository_path, 'latest', storage_config, local_borg_version, local_path, remote_path ) except ValueError: logger.warning('No archives found. Skipping extract consistency check.') @@ -44,7 +44,9 @@ def extract_last_archive_dry_run( + lock_wait_flags + verbosity_flags + list_flag - + flags.make_repository_archive_flags(repository, last_archive_name, local_borg_version) + + flags.make_repository_archive_flags( + repository_path, last_archive_name, local_borg_version + ) ) execute_command( diff --git a/borgmatic/borg/flags.py b/borgmatic/borg/flags.py index 845e0ff..5dcebf5 100644 --- a/borgmatic/borg/flags.py +++ b/borgmatic/borg/flags.py @@ -33,7 +33,7 @@ def make_flags_from_arguments(arguments, excludes=()): ) -def make_repository_flags(repository, local_borg_version): +def make_repository_flags(repository_path, local_borg_version): ''' Given the path of a Borg repository and the local Borg version, return Borg-version-appropriate command-line flags (as a tuple) for selecting that repository. @@ -42,17 +42,17 @@ def make_repository_flags(repository, local_borg_version): ('--repo',) if feature.available(feature.Feature.SEPARATE_REPOSITORY_ARCHIVE, local_borg_version) else () - ) + (repository,) + ) + (repository_path,) -def make_repository_archive_flags(repository, archive, local_borg_version): +def make_repository_archive_flags(repository_path, archive, local_borg_version): ''' Given the path of a Borg repository, an archive name or pattern, and the local Borg version, return Borg-version-appropriate command-line flags (as a tuple) for selecting that repository and archive. ''' return ( - ('--repo', repository, archive) + ('--repo', repository_path, archive) if feature.available(feature.Feature.SEPARATE_REPOSITORY_ARCHIVE, local_borg_version) - else (f'{repository}::{archive}',) + else (f'{repository_path}::{archive}',) ) diff --git a/borgmatic/borg/info.py b/borgmatic/borg/info.py index bcde24c..6142104 100644 --- a/borgmatic/borg/info.py +++ b/borgmatic/borg/info.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) def display_archives_info( - repository, + repository_path, storage_config, local_borg_version, info_arguments, @@ -49,7 +49,7 @@ def display_archives_info( + flags.make_flags_from_arguments( info_arguments, excludes=('repository', 'archive', 'prefix') ) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) + ( flags.make_flags('match-archives', info_arguments.archive) if feature.available(feature.Feature.MATCH_ARCHIVES, local_borg_version) diff --git a/borgmatic/borg/list.py b/borgmatic/borg/list.py index 916d17b..908f8fe 100644 --- a/borgmatic/borg/list.py +++ b/borgmatic/borg/list.py @@ -21,7 +21,7 @@ MAKE_FLAGS_EXCLUDES = ( def make_list_command( - repository, + repository_path, storage_config, local_borg_version, list_arguments, @@ -52,10 +52,10 @@ def make_list_command( + flags.make_flags_from_arguments(list_arguments, excludes=MAKE_FLAGS_EXCLUDES) + ( flags.make_repository_archive_flags( - repository, list_arguments.archive, local_borg_version + repository_path, list_arguments.archive, local_borg_version ) if list_arguments.archive - else flags.make_repository_flags(repository, local_borg_version) + else flags.make_repository_flags(repository_path, local_borg_version) ) + (tuple(list_arguments.paths) if list_arguments.paths else ()) ) @@ -86,7 +86,7 @@ def make_find_paths(find_paths): def capture_archive_listing( - repository, + repository_path, archive, storage_config, local_borg_version, @@ -104,11 +104,11 @@ def capture_archive_listing( return tuple( execute_command_and_capture_output( make_list_command( - repository, + repository_path, storage_config, local_borg_version, argparse.Namespace( - repository=repository, + repository=repository_path, archive=archive, paths=[f'sh:{list_path}'], find_paths=None, @@ -126,7 +126,7 @@ def capture_archive_listing( def list_archive( - repository, + repository_path, storage_config, local_borg_version, list_arguments, @@ -149,7 +149,7 @@ def list_archive( ) rlist_arguments = argparse.Namespace( - repository=repository, + repository=repository_path, short=list_arguments.short, format=list_arguments.format, json=list_arguments.json, @@ -160,7 +160,12 @@ def list_archive( last=list_arguments.last, ) return rlist.list_repository( - repository, storage_config, local_borg_version, rlist_arguments, local_path, remote_path + repository_path, + storage_config, + local_borg_version, + rlist_arguments, + local_path, + remote_path, ) if list_arguments.archive: @@ -181,7 +186,7 @@ def list_archive( # getting a list of archives to search. if list_arguments.find_paths and not list_arguments.archive: rlist_arguments = argparse.Namespace( - repository=repository, + repository=repository_path, short=True, format=None, json=None, @@ -196,7 +201,7 @@ def list_archive( archive_lines = tuple( execute_command_and_capture_output( rlist.make_rlist_command( - repository, + repository_path, storage_config, local_borg_version, rlist_arguments, @@ -213,7 +218,7 @@ def list_archive( # For each archive listed by Borg, run list on the contents of that archive. for archive in archive_lines: - logger.answer(f'{repository}: Listing archive {archive}') + logger.answer(f'{repository_path}: Listing archive {archive}') archive_arguments = copy.copy(list_arguments) archive_arguments.archive = archive @@ -224,7 +229,7 @@ def list_archive( setattr(archive_arguments, name, None) main_command = make_list_command( - repository, + repository_path, storage_config, local_borg_version, archive_arguments, diff --git a/borgmatic/borg/mount.py b/borgmatic/borg/mount.py index 92d689b..07a6c63 100644 --- a/borgmatic/borg/mount.py +++ b/borgmatic/borg/mount.py @@ -7,7 +7,7 @@ logger = logging.getLogger(__name__) def mount_archive( - repository, + repository_path, archive, mount_point, paths, @@ -38,7 +38,7 @@ def mount_archive( + (('-o', options) if options else ()) + ( ( - flags.make_repository_flags(repository, local_borg_version) + flags.make_repository_flags(repository_path, local_borg_version) + ( ('--match-archives', archive) if feature.available(feature.Feature.MATCH_ARCHIVES, local_borg_version) @@ -47,9 +47,9 @@ def mount_archive( ) if feature.available(feature.Feature.SEPARATE_REPOSITORY_ARCHIVE, local_borg_version) else ( - flags.make_repository_archive_flags(repository, archive, local_borg_version) + flags.make_repository_archive_flags(repository_path, archive, local_borg_version) if archive - else flags.make_repository_flags(repository, local_borg_version) + else flags.make_repository_flags(repository_path, local_borg_version) ) ) + (mount_point,) diff --git a/borgmatic/borg/prune.py b/borgmatic/borg/prune.py index 5be85de..d21ceee 100644 --- a/borgmatic/borg/prune.py +++ b/borgmatic/borg/prune.py @@ -39,7 +39,7 @@ def make_prune_flags(retention_config, local_borg_version): def prune_archives( dry_run, - repository, + repository_path, storage_config, retention_config, local_borg_version, @@ -74,7 +74,7 @@ def prune_archives( + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) + (('--dry-run',) if dry_run else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) if stats or list_archives: diff --git a/borgmatic/borg/rcreate.py b/borgmatic/borg/rcreate.py index d3a8f7a..7510529 100644 --- a/borgmatic/borg/rcreate.py +++ b/borgmatic/borg/rcreate.py @@ -13,7 +13,7 @@ RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE = 2 def create_repository( dry_run, - repository, + repository_path, storage_config, local_borg_version, encryption_mode, @@ -33,14 +33,14 @@ def create_repository( ''' try: rinfo.display_repository_info( - repository, + repository_path, storage_config, local_borg_version, argparse.Namespace(json=True), local_path, remote_path, ) - logger.info(f'{repository}: Repository already exists. Skipping creation.') + logger.info(f'{repository_path}: Repository already exists. Skipping creation.') return except subprocess.CalledProcessError as error: if error.returncode != RINFO_REPOSITORY_NOT_FOUND_EXIT_CODE: @@ -65,11 +65,11 @@ def create_repository( + (('--debug',) if logger.isEnabledFor(logging.DEBUG) else ()) + (('--remote-path', remote_path) if remote_path else ()) + (tuple(extra_borg_options.split(' ')) if extra_borg_options else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) if dry_run: - logging.info(f'{repository}: Skipping repository creation (dry run)') + logging.info(f'{repository_path}: Skipping repository creation (dry run)') return # Do not capture output here, so as to support interactive prompts. diff --git a/borgmatic/borg/rinfo.py b/borgmatic/borg/rinfo.py index 7bc9a5e..8a30b7f 100644 --- a/borgmatic/borg/rinfo.py +++ b/borgmatic/borg/rinfo.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) def display_repository_info( - repository, + repository_path, storage_config, local_borg_version, rinfo_arguments, @@ -43,7 +43,7 @@ def display_repository_info( + flags.make_flags('remote-path', remote_path) + flags.make_flags('lock-wait', lock_wait) + (('--json',) if rinfo_arguments.json else ()) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) extra_environment = environment.make_environment(storage_config) diff --git a/borgmatic/borg/rlist.py b/borgmatic/borg/rlist.py index 43bc28d..8625363 100644 --- a/borgmatic/borg/rlist.py +++ b/borgmatic/borg/rlist.py @@ -8,7 +8,12 @@ logger = logging.getLogger(__name__) def resolve_archive_name( - repository, archive, storage_config, local_borg_version, local_path='borg', remote_path=None + repository_path, + archive, + storage_config, + local_borg_version, + local_path='borg', + remote_path=None, ): ''' Given a local or remote repository path, an archive name, a storage config dict, a local Borg @@ -31,7 +36,7 @@ def resolve_archive_name( + flags.make_flags('lock-wait', lock_wait) + flags.make_flags('last', 1) + ('--short',) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) output = execute_command_and_capture_output( @@ -42,7 +47,7 @@ def resolve_archive_name( except IndexError: raise ValueError('No archives found in the repository') - logger.debug(f'{repository}: Latest archive is {latest_archive}') + logger.debug(f'{repository_path}: Latest archive is {latest_archive}') return latest_archive @@ -51,7 +56,7 @@ MAKE_FLAGS_EXCLUDES = ('repository', 'prefix') def make_rlist_command( - repository, + repository_path, storage_config, local_borg_version, rlist_arguments, @@ -92,12 +97,12 @@ def make_rlist_command( else () ) + flags.make_flags_from_arguments(rlist_arguments, excludes=MAKE_FLAGS_EXCLUDES) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) ) def list_repository( - repository, + repository_path, storage_config, local_borg_version, rlist_arguments, @@ -113,7 +118,12 @@ def list_repository( borg_environment = environment.make_environment(storage_config) main_command = make_rlist_command( - repository, storage_config, local_borg_version, rlist_arguments, local_path, remote_path + repository_path, + storage_config, + local_borg_version, + rlist_arguments, + local_path, + remote_path, ) if rlist_arguments.json: diff --git a/borgmatic/borg/transfer.py b/borgmatic/borg/transfer.py index bad02d0..29e205c 100644 --- a/borgmatic/borg/transfer.py +++ b/borgmatic/borg/transfer.py @@ -9,7 +9,7 @@ logger = logging.getLogger(__name__) def transfer_archives( dry_run, - repository, + repository_path, storage_config, local_borg_version, transfer_arguments, @@ -38,7 +38,7 @@ def transfer_archives( transfer_arguments, excludes=('repository', 'source_repository', 'archive', 'match_archives'), ) - + flags.make_repository_flags(repository, local_borg_version) + + flags.make_repository_flags(repository_path, local_borg_version) + flags.make_flags('other-repo', transfer_arguments.source_repository) + flags.make_flags('dry-run', dry_run) ) diff --git a/tests/unit/borg/test_borg.py b/tests/unit/borg/test_borg.py index 6eae5fb..545da6c 100644 --- a/tests/unit/borg/test_borg.py +++ b/tests/unit/borg/test_borg.py @@ -21,7 +21,10 @@ def test_run_arbitrary_borg_calls_borg_with_parameters(): ) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], + repository_path='repo', + storage_config={}, + local_borg_version='1.2.3', + options=['break-lock'], ) @@ -40,7 +43,10 @@ def test_run_arbitrary_borg_with_log_info_calls_borg_with_info_parameter(): insert_logging_mock(logging.INFO) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], + repository_path='repo', + storage_config={}, + local_borg_version='1.2.3', + options=['break-lock'], ) @@ -59,7 +65,10 @@ def test_run_arbitrary_borg_with_log_debug_calls_borg_with_debug_parameter(): insert_logging_mock(logging.DEBUG) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], + repository_path='repo', + storage_config={}, + local_borg_version='1.2.3', + options=['break-lock'], ) @@ -80,7 +89,7 @@ def test_run_arbitrary_borg_with_lock_wait_calls_borg_with_lock_wait_parameters( ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config=storage_config, local_borg_version='1.2.3', options=['break-lock'], @@ -103,7 +112,7 @@ def test_run_arbitrary_borg_with_archive_calls_borg_with_archive_parameter(): ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], @@ -125,7 +134,7 @@ def test_run_arbitrary_borg_with_local_path_calls_borg_via_local_path(): ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], @@ -149,7 +158,7 @@ def test_run_arbitrary_borg_with_remote_path_calls_borg_with_remote_path_paramet ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['break-lock'], @@ -171,7 +180,7 @@ def test_run_arbitrary_borg_passes_borg_specific_parameters_to_borg(): ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['list', '--progress'], @@ -192,7 +201,7 @@ def test_run_arbitrary_borg_omits_dash_dash_in_parameters_passed_to_borg(): ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['--', 'break-lock'], @@ -213,7 +222,7 @@ def test_run_arbitrary_borg_without_borg_specific_parameters_does_not_raise(): ) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=[], + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=[], ) @@ -231,7 +240,10 @@ def test_run_arbitrary_borg_passes_key_sub_command_to_borg_before_repository(): ) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=['key', 'export'], + repository_path='repo', + storage_config={}, + local_borg_version='1.2.3', + options=['key', 'export'], ) @@ -249,7 +261,7 @@ def test_run_arbitrary_borg_passes_debug_sub_command_to_borg_before_repository() ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['debug', 'dump-manifest', 'path'], @@ -270,7 +282,10 @@ def test_run_arbitrary_borg_with_debug_info_command_does_not_pass_borg_repositor ) module.run_arbitrary_borg( - repository='repo', storage_config={}, local_borg_version='1.2.3', options=['debug', 'info'], + repository_path='repo', + storage_config={}, + local_borg_version='1.2.3', + options=['debug', 'info'], ) @@ -288,7 +303,7 @@ def test_run_arbitrary_borg_with_debug_convert_profile_command_does_not_pass_bor ) module.run_arbitrary_borg( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', options=['debug', 'convert-profile', 'in', 'out'], diff --git a/tests/unit/borg/test_break_lock.py b/tests/unit/borg/test_break_lock.py index 0663f93..210acee 100644 --- a/tests/unit/borg/test_break_lock.py +++ b/tests/unit/borg/test_break_lock.py @@ -19,7 +19,7 @@ def test_break_lock_calls_borg_with_required_flags(): insert_execute_command_mock(('borg', 'break-lock', 'repo')) module.break_lock( - repository='repo', storage_config={}, local_borg_version='1.2.3', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', ) @@ -28,7 +28,7 @@ def test_break_lock_calls_borg_with_remote_path_flags(): insert_execute_command_mock(('borg', 'break-lock', '--remote-path', 'borg1', 'repo')) module.break_lock( - repository='repo', storage_config={}, local_borg_version='1.2.3', remote_path='borg1', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', remote_path='borg1', ) @@ -37,7 +37,7 @@ def test_break_lock_calls_borg_with_umask_flags(): insert_execute_command_mock(('borg', 'break-lock', '--umask', '0770', 'repo')) module.break_lock( - repository='repo', storage_config={'umask': '0770'}, local_borg_version='1.2.3', + repository_path='repo', storage_config={'umask': '0770'}, local_borg_version='1.2.3', ) @@ -46,7 +46,7 @@ def test_break_lock_calls_borg_with_lock_wait_flags(): insert_execute_command_mock(('borg', 'break-lock', '--lock-wait', '5', 'repo')) module.break_lock( - repository='repo', storage_config={'lock_wait': '5'}, local_borg_version='1.2.3', + repository_path='repo', storage_config={'lock_wait': '5'}, local_borg_version='1.2.3', ) @@ -56,7 +56,7 @@ def test_break_lock_with_log_info_calls_borg_with_info_parameter(): insert_logging_mock(logging.INFO) module.break_lock( - repository='repo', storage_config={}, local_borg_version='1.2.3', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', ) @@ -66,5 +66,5 @@ def test_break_lock_with_log_debug_calls_borg_with_debug_flags(): insert_logging_mock(logging.DEBUG) module.break_lock( - repository='repo', storage_config={}, local_borg_version='1.2.3', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', ) diff --git a/tests/unit/borg/test_check.py b/tests/unit/borg/test_check.py index ba82225..7575556 100644 --- a/tests/unit/borg/test_check.py +++ b/tests/unit/borg/test_check.py @@ -370,7 +370,7 @@ def test_check_archives_with_progress_calls_borg_with_progress_parameter(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -400,7 +400,7 @@ def test_check_archives_with_repair_calls_borg_with_repair_parameter(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -435,7 +435,7 @@ def test_check_archives_calls_borg_with_parameters(checks): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -455,7 +455,7 @@ def test_check_archives_with_json_error_raises(): with pytest.raises(ValueError): module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -473,7 +473,7 @@ def test_check_archives_with_missing_json_keys_raises(): with pytest.raises(ValueError): module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -497,7 +497,7 @@ def test_check_archives_with_extract_check_calls_extract_only(): insert_execute_command_never() module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -521,7 +521,7 @@ def test_check_archives_with_log_info_calls_borg_with_info_parameter(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -545,7 +545,7 @@ def test_check_archives_with_log_debug_calls_borg_with_debug_parameter(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -563,7 +563,7 @@ def test_check_archives_without_any_checks_bails(): insert_execute_command_never() module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -589,7 +589,7 @@ def test_check_archives_with_local_path_calls_borg_via_local_path(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -616,7 +616,7 @@ def test_check_archives_with_remote_path_calls_borg_with_remote_path_parameters( flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -643,7 +643,7 @@ def test_check_archives_with_lock_wait_calls_borg_with_lock_wait_parameters(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={'lock_wait': 5}, consistency_config=consistency_config, @@ -670,7 +670,7 @@ def test_check_archives_with_retention_prefix(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={}, consistency_config=consistency_config, @@ -693,7 +693,7 @@ def test_check_archives_with_extra_borg_options_calls_borg_with_extra_options(): flexmock(module).should_receive('write_check_time') module.check_archives( - repository='repo', + repository_path='repo', location_config={}, storage_config={'extra_borg_options': {'check': '--extra --options'}}, consistency_config=consistency_config, diff --git a/tests/unit/borg/test_compact.py b/tests/unit/borg/test_compact.py index 36760f3..60447db 100644 --- a/tests/unit/borg/test_compact.py +++ b/tests/unit/borg/test_compact.py @@ -25,7 +25,7 @@ def test_compact_segments_calls_borg_with_parameters(): insert_execute_command_mock(COMPACT_COMMAND + ('repo',), logging.INFO) module.compact_segments( - dry_run=False, repository='repo', storage_config={}, local_borg_version='1.2.3' + dry_run=False, repository_path='repo', storage_config={}, local_borg_version='1.2.3' ) @@ -35,7 +35,7 @@ def test_compact_segments_with_log_info_calls_borg_with_info_parameter(): insert_logging_mock(logging.INFO) module.compact_segments( - repository='repo', storage_config={}, local_borg_version='1.2.3', dry_run=False + repository_path='repo', storage_config={}, local_borg_version='1.2.3', dry_run=False ) @@ -45,7 +45,7 @@ def test_compact_segments_with_log_debug_calls_borg_with_debug_parameter(): insert_logging_mock(logging.DEBUG) module.compact_segments( - repository='repo', storage_config={}, local_borg_version='1.2.3', dry_run=False + repository_path='repo', storage_config={}, local_borg_version='1.2.3', dry_run=False ) @@ -53,7 +53,7 @@ def test_compact_segments_with_dry_run_skips_borg_call(): flexmock(module).should_receive('execute_command').never() module.compact_segments( - repository='repo', storage_config={}, local_borg_version='1.2.3', dry_run=True + repository_path='repo', storage_config={}, local_borg_version='1.2.3', dry_run=True ) @@ -63,7 +63,7 @@ def test_compact_segments_with_local_path_calls_borg_via_local_path(): module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', local_path='borg1', @@ -76,7 +76,7 @@ def test_compact_segments_with_remote_path_calls_borg_with_remote_path_parameter module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', remote_path='borg1', @@ -89,7 +89,7 @@ def test_compact_segments_with_progress_calls_borg_with_progress_parameter(): module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', progress=True, @@ -102,7 +102,7 @@ def test_compact_segments_with_cleanup_commits_calls_borg_with_cleanup_commits_p module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', cleanup_commits=True, @@ -115,7 +115,7 @@ def test_compact_segments_with_threshold_calls_borg_with_threshold_parameter(): module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', threshold=20, @@ -128,7 +128,10 @@ def test_compact_segments_with_umask_calls_borg_with_umask_parameters(): insert_execute_command_mock(COMPACT_COMMAND + ('--umask', '077', 'repo'), logging.INFO) module.compact_segments( - dry_run=False, repository='repo', storage_config=storage_config, local_borg_version='1.2.3' + dry_run=False, + repository_path='repo', + storage_config=storage_config, + local_borg_version='1.2.3', ) @@ -138,7 +141,10 @@ def test_compact_segments_with_lock_wait_calls_borg_with_lock_wait_parameters(): insert_execute_command_mock(COMPACT_COMMAND + ('--lock-wait', '5', 'repo'), logging.INFO) module.compact_segments( - dry_run=False, repository='repo', storage_config=storage_config, local_borg_version='1.2.3' + dry_run=False, + repository_path='repo', + storage_config=storage_config, + local_borg_version='1.2.3', ) @@ -148,7 +154,7 @@ def test_compact_segments_with_extra_borg_options_calls_borg_with_extra_options( module.compact_segments( dry_run=False, - repository='repo', + repository_path='repo', storage_config={'extra_borg_options': {'compact': '--extra --options'}}, local_borg_version='1.2.3', ) diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index 5fb51f3..42fedd5 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -484,7 +484,7 @@ def test_create_archive_calls_borg_with_parameters(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -527,7 +527,7 @@ def test_create_archive_calls_borg_with_environment(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -572,7 +572,7 @@ def test_create_archive_with_patterns_calls_borg_with_patterns_including_convert module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -617,7 +617,7 @@ def test_create_archive_with_exclude_patterns_calls_borg_with_excludes(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -660,7 +660,7 @@ def test_create_archive_with_log_info_calls_borg_with_info_parameter(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -700,7 +700,7 @@ def test_create_archive_with_log_info_and_json_suppresses_most_borg_output(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -744,7 +744,7 @@ def test_create_archive_with_log_debug_calls_borg_with_debug_parameter(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -784,7 +784,7 @@ def test_create_archive_with_log_debug_and_json_suppresses_most_borg_output(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -827,7 +827,7 @@ def test_create_archive_with_dry_run_calls_borg_with_dry_run_parameter(): module.create_archive( dry_run=True, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -872,7 +872,7 @@ def test_create_archive_with_stats_and_dry_run_calls_borg_without_stats_paramete module.create_archive( dry_run=True, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -915,7 +915,7 @@ def test_create_archive_with_checkpoint_interval_calls_borg_with_checkpoint_inte module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -957,7 +957,7 @@ def test_create_archive_with_checkpoint_volume_calls_borg_with_checkpoint_volume module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -999,7 +999,7 @@ def test_create_archive_with_chunker_params_calls_borg_with_chunker_params_param module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1041,7 +1041,7 @@ def test_create_archive_with_compression_calls_borg_with_compression_parameters( module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1088,7 +1088,7 @@ def test_create_archive_with_upload_rate_limit_calls_borg_with_upload_ratelimit_ module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1132,7 +1132,7 @@ def test_create_archive_with_working_directory_calls_borg_with_working_directory module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1175,7 +1175,7 @@ def test_create_archive_with_one_file_system_calls_borg_with_one_file_system_par module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1223,7 +1223,7 @@ def test_create_archive_with_numeric_ids_calls_borg_with_numeric_ids_parameter( module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1276,7 +1276,7 @@ def test_create_archive_with_read_special_calls_borg_with_read_special_parameter module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1326,7 +1326,7 @@ def test_create_archive_with_basic_option_calls_borg_with_corresponding_paramete module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1380,7 +1380,7 @@ def test_create_archive_with_atime_option_calls_borg_with_corresponding_paramete module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1434,7 +1434,7 @@ def test_create_archive_with_flags_option_calls_borg_with_corresponding_paramete module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1477,7 +1477,7 @@ def test_create_archive_with_files_cache_calls_borg_with_files_cache_parameters( module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1520,7 +1520,7 @@ def test_create_archive_with_local_path_calls_borg_via_local_path(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1563,7 +1563,7 @@ def test_create_archive_with_remote_path_calls_borg_with_remote_path_parameters( module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1606,7 +1606,7 @@ def test_create_archive_with_umask_calls_borg_with_umask_parameters(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1648,7 +1648,7 @@ def test_create_archive_with_lock_wait_calls_borg_with_lock_wait_parameters(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1690,7 +1690,7 @@ def test_create_archive_with_stats_calls_borg_with_stats_parameter_and_answer_ou module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1733,7 +1733,7 @@ def test_create_archive_with_files_calls_borg_with_list_parameter_and_answer_out module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1777,7 +1777,7 @@ def test_create_archive_with_progress_and_log_info_calls_borg_with_progress_para module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1820,7 +1820,7 @@ def test_create_archive_with_progress_calls_borg_with_progress_parameter(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1880,7 +1880,7 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -1943,7 +1943,7 @@ def test_create_archive_with_stream_processes_ignores_read_special_false_and_log module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2011,7 +2011,7 @@ def test_create_archive_with_stream_processes_adds_special_files_to_excludes(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2074,7 +2074,7 @@ def test_create_archive_with_stream_processes_and_read_special_does_not_add_spec module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2115,7 +2115,7 @@ def test_create_archive_with_json_calls_borg_with_json_parameter(): json_output = module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2157,7 +2157,7 @@ def test_create_archive_with_stats_and_json_calls_borg_without_stats_parameter() json_output = module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2204,7 +2204,7 @@ def test_create_archive_with_source_directories_glob_expands(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo*'], 'repositories': ['repo'], @@ -2247,7 +2247,7 @@ def test_create_archive_with_non_matching_source_directories_glob_passes_through module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo*'], 'repositories': ['repo'], @@ -2289,7 +2289,7 @@ def test_create_archive_with_glob_calls_borg_with_expanded_directories(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo*'], 'repositories': ['repo'], @@ -2331,7 +2331,7 @@ def test_create_archive_with_archive_name_format_calls_borg_with_archive_name(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2374,7 +2374,7 @@ def test_create_archive_with_archive_name_format_accepts_borg_placeholders(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2417,7 +2417,7 @@ def test_create_archive_with_repository_accepts_borg_placeholders(): module.create_archive( dry_run=False, - repository='{fqdn}', # noqa: FS003 + repository_path='{fqdn}', # noqa: FS003 location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['{fqdn}'], # noqa: FS003 @@ -2459,7 +2459,7 @@ def test_create_archive_with_extra_borg_options_calls_borg_with_extra_options(): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2519,7 +2519,7 @@ def test_create_archive_with_stream_processes_calls_borg_with_processes_and_read module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], @@ -2543,7 +2543,7 @@ def test_create_archive_with_non_existent_directory_and_source_directories_must_ with pytest.raises(ValueError): module.create_archive( dry_run=False, - repository='repo', + repository_path='repo', location_config={ 'source_directories': ['foo', 'bar'], 'repositories': ['repo'], diff --git a/tests/unit/borg/test_export_tar.py b/tests/unit/borg/test_export_tar.py index a3c0352..92776dd 100644 --- a/tests/unit/borg/test_export_tar.py +++ b/tests/unit/borg/test_export_tar.py @@ -32,7 +32,7 @@ def test_export_tar_archive_calls_borg_with_path_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=['path1', 'path2'], destination_path='test.tar', @@ -53,7 +53,7 @@ def test_export_tar_archive_calls_borg_with_local_path_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -75,7 +75,7 @@ def test_export_tar_archive_calls_borg_with_remote_path_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -97,7 +97,7 @@ def test_export_tar_archive_calls_borg_with_umask_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -118,7 +118,7 @@ def test_export_tar_archive_calls_borg_with_lock_wait_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -138,7 +138,7 @@ def test_export_tar_archive_with_log_info_calls_borg_with_info_parameter(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -160,7 +160,7 @@ def test_export_tar_archive_with_log_debug_calls_borg_with_debug_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -179,7 +179,7 @@ def test_export_tar_archive_calls_borg_with_dry_run_parameter(): module.export_tar_archive( dry_run=True, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -200,7 +200,7 @@ def test_export_tar_archive_calls_borg_with_tar_filter_parameters(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -223,7 +223,7 @@ def test_export_tar_archive_calls_borg_with_list_parameter(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -245,7 +245,7 @@ def test_export_tar_archive_calls_borg_with_strip_components_parameter(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='test.tar', @@ -265,7 +265,7 @@ def test_export_tar_archive_skips_abspath_for_remote_repository_parameter(): module.export_tar_archive( dry_run=False, - repository='server:repo', + repository_path='server:repo', archive='archive', paths=None, destination_path='test.tar', @@ -284,7 +284,7 @@ def test_export_tar_archive_calls_borg_with_stdout_destination_path(): module.export_tar_archive( dry_run=False, - repository='repo', + repository_path='repo', archive='archive', paths=None, destination_path='-', diff --git a/tests/unit/borg/test_extract.py b/tests/unit/borg/test_extract.py index d27026e..de29cf4 100644 --- a/tests/unit/borg/test_extract.py +++ b/tests/unit/borg/test_extract.py @@ -23,7 +23,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_last_archive(): ) module.extract_last_archive_dry_run( - storage_config={}, local_borg_version='1.2.3', repository='repo', lock_wait=None + storage_config={}, local_borg_version='1.2.3', repository_path='repo', lock_wait=None ) @@ -32,7 +32,7 @@ def test_extract_last_archive_dry_run_without_any_archives_should_not_raise(): flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(('repo',)) module.extract_last_archive_dry_run( - storage_config={}, local_borg_version='1.2.3', repository='repo', lock_wait=None + storage_config={}, local_borg_version='1.2.3', repository_path='repo', lock_wait=None ) @@ -45,7 +45,7 @@ def test_extract_last_archive_dry_run_with_log_info_calls_borg_with_info_paramet ) module.extract_last_archive_dry_run( - storage_config={}, local_borg_version='1.2.3', repository='repo', lock_wait=None + storage_config={}, local_borg_version='1.2.3', repository_path='repo', lock_wait=None ) @@ -60,7 +60,7 @@ def test_extract_last_archive_dry_run_with_log_debug_calls_borg_with_debug_param ) module.extract_last_archive_dry_run( - storage_config={}, local_borg_version='1.2.3', repository='repo', lock_wait=None + storage_config={}, local_borg_version='1.2.3', repository_path='repo', lock_wait=None ) @@ -74,7 +74,7 @@ def test_extract_last_archive_dry_run_calls_borg_via_local_path(): module.extract_last_archive_dry_run( storage_config={}, local_borg_version='1.2.3', - repository='repo', + repository_path='repo', lock_wait=None, local_path='borg1', ) @@ -92,7 +92,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_remote_path_parameters(): module.extract_last_archive_dry_run( storage_config={}, local_borg_version='1.2.3', - repository='repo', + repository_path='repo', lock_wait=None, remote_path='borg1', ) @@ -108,7 +108,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_lock_wait_parameters(): ) module.extract_last_archive_dry_run( - storage_config={}, local_borg_version='1.2.3', repository='repo', lock_wait=5 + storage_config={}, local_borg_version='1.2.3', repository_path='repo', lock_wait=5 ) diff --git a/tests/unit/borg/test_flags.py b/tests/unit/borg/test_flags.py index 7bf621d..1985d81 100644 --- a/tests/unit/borg/test_flags.py +++ b/tests/unit/borg/test_flags.py @@ -50,7 +50,7 @@ def test_make_flags_from_arguments_omits_excludes(): def test_make_repository_flags_with_borg_features_includes_repo_flag(): flexmock(module.feature).should_receive('available').and_return(True) - assert module.make_repository_flags(repository='repo', local_borg_version='1.2.3') == ( + assert module.make_repository_flags(repository_path='repo', local_borg_version='1.2.3') == ( '--repo', 'repo', ) @@ -59,14 +59,16 @@ def test_make_repository_flags_with_borg_features_includes_repo_flag(): def test_make_repository_flags_without_borg_features_includes_omits_flag(): flexmock(module.feature).should_receive('available').and_return(False) - assert module.make_repository_flags(repository='repo', local_borg_version='1.2.3') == ('repo',) + assert module.make_repository_flags(repository_path='repo', local_borg_version='1.2.3') == ( + 'repo', + ) def test_make_repository_archive_flags_with_borg_features_separates_repository_and_archive(): flexmock(module.feature).should_receive('available').and_return(True) assert module.make_repository_archive_flags( - repository='repo', archive='archive', local_borg_version='1.2.3' + repository_path='repo', archive='archive', local_borg_version='1.2.3' ) == ('--repo', 'repo', 'archive',) @@ -74,5 +76,5 @@ def test_make_repository_archive_flags_with_borg_features_joins_repository_and_a flexmock(module.feature).should_receive('available').and_return(False) assert module.make_repository_archive_flags( - repository='repo', archive='archive', local_borg_version='1.2.3' + repository_path='repo', archive='archive', local_borg_version='1.2.3' ) == ('repo::archive',) diff --git a/tests/unit/borg/test_info.py b/tests/unit/borg/test_info.py index ab92065..fcc556a 100644 --- a/tests/unit/borg/test_info.py +++ b/tests/unit/borg/test_info.py @@ -23,7 +23,7 @@ def test_display_archives_info_calls_borg_with_parameters(): ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -45,7 +45,7 @@ def test_display_archives_info_with_log_info_calls_borg_with_info_parameter(): ) insert_logging_mock(logging.INFO) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -65,7 +65,7 @@ def test_display_archives_info_with_log_info_and_json_suppresses_most_borg_outpu insert_logging_mock(logging.INFO) json_output = module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=True, prefix=None), @@ -90,7 +90,7 @@ def test_display_archives_info_with_log_debug_calls_borg_with_debug_parameter(): insert_logging_mock(logging.DEBUG) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -110,7 +110,7 @@ def test_display_archives_info_with_log_debug_and_json_suppresses_most_borg_outp insert_logging_mock(logging.DEBUG) json_output = module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=True, prefix=None), @@ -131,7 +131,7 @@ def test_display_archives_info_with_json_calls_borg_with_json_parameter(): ).and_return('[]') json_output = module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=True, prefix=None), @@ -158,7 +158,7 @@ def test_display_archives_info_with_archive_calls_borg_with_match_archives_param ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive='archive', json=False, prefix=None), @@ -180,7 +180,7 @@ def test_display_archives_info_with_local_path_calls_borg_via_local_path(): ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -206,7 +206,7 @@ def test_display_archives_info_with_remote_path_calls_borg_with_remote_path_para ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -233,7 +233,7 @@ def test_display_archives_info_with_lock_wait_calls_borg_with_lock_wait_paramete ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config=storage_config, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None), @@ -258,7 +258,7 @@ def test_display_archives_info_with_prefix_calls_borg_with_match_archives_parame ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix='foo'), @@ -284,7 +284,7 @@ def test_display_archives_info_passes_through_arguments_to_borg(argument_name): ) module.display_archives_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', info_arguments=flexmock(archive=None, json=False, prefix=None, **{argument_name: 'value'}), diff --git a/tests/unit/borg/test_list.py b/tests/unit/borg/test_list.py index cedcec8..37af65a 100644 --- a/tests/unit/borg/test_list.py +++ b/tests/unit/borg/test_list.py @@ -16,7 +16,7 @@ def test_make_list_command_includes_log_info(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False), @@ -32,7 +32,7 @@ def test_make_list_command_includes_json_but_not_info(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=True), @@ -48,7 +48,7 @@ def test_make_list_command_includes_log_debug(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False), @@ -64,7 +64,7 @@ def test_make_list_command_includes_json_but_not_debug(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=True), @@ -79,7 +79,7 @@ def test_make_list_command_includes_json(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=True), @@ -96,7 +96,7 @@ def test_make_list_command_includes_lock_wait(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={'lock_wait': 5}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False), @@ -113,7 +113,7 @@ def test_make_list_command_includes_archive(): ) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive='archive', paths=None, json=False), @@ -130,7 +130,7 @@ def test_make_list_command_includes_archive_and_path(): ) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive='archive', paths=['var/lib'], json=False), @@ -145,7 +145,7 @@ def test_make_list_command_includes_local_path(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False), @@ -163,7 +163,7 @@ def test_make_list_command_includes_remote_path(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False), @@ -179,7 +179,7 @@ def test_make_list_command_includes_short(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock(archive=None, paths=None, json=False, short=True), @@ -210,7 +210,7 @@ def test_make_list_command_includes_additional_flags(argument_name): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_list_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=flexmock( @@ -259,7 +259,7 @@ def test_capture_archive_listing_does_not_raise(): flexmock(module).should_receive('make_list_command') module.capture_archive_listing( - repository='repo', + repository_path='repo', archive='archive', storage_config=flexmock(), local_borg_version=flexmock(), @@ -284,7 +284,7 @@ def test_list_archive_calls_borg_with_parameters(): flexmock(module.feature).should_receive('available').and_return(False) flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -301,7 +301,7 @@ def test_list_archive_calls_borg_with_parameters(): ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -318,7 +318,7 @@ def test_list_archive_with_archive_and_json_errors(): with pytest.raises(ValueError): module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -343,7 +343,7 @@ def test_list_archive_calls_borg_with_local_path(): flexmock(module.feature).should_receive('available').and_return(False) flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -360,7 +360,7 @@ def test_list_archive_calls_borg_with_local_path(): ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -408,7 +408,7 @@ def test_list_archive_calls_borg_multiple_times_with_find_paths(): ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -433,7 +433,7 @@ def test_list_archive_calls_borg_with_archive(): flexmock(module.feature).should_receive('available').and_return(False) flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -450,7 +450,7 @@ def test_list_archive_calls_borg_with_archive(): ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -480,7 +480,7 @@ def test_list_archive_without_archive_delegates_to_list_repository(): flexmock(module).should_receive('execute_command').never() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -510,7 +510,7 @@ def test_list_archive_with_borg_features_without_archive_delegates_to_list_repos flexmock(module).should_receive('execute_command').never() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=list_arguments, @@ -537,7 +537,7 @@ def test_list_archive_with_archive_ignores_archive_filter_flag(archive_filter_fl module.feature.Feature.RLIST, '1.2.3' ).and_return(False) flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=argparse.Namespace( @@ -556,7 +556,7 @@ def test_list_archive_with_archive_ignores_archive_filter_flag(archive_filter_fl ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=argparse.Namespace( @@ -586,7 +586,7 @@ def test_list_archive_with_find_paths_allows_archive_filter_flag_but_only_passes flexmock(module.feature).should_receive('available').and_return(True) flexmock(module.rlist).should_receive('make_rlist_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=argparse.Namespace( @@ -601,7 +601,7 @@ def test_list_archive_with_find_paths_allows_archive_filter_flag_but_only_passes ).and_return('archive1\narchive2').once() flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=argparse.Namespace( @@ -619,7 +619,7 @@ def test_list_archive_with_find_paths_allows_archive_filter_flag_but_only_passes ).and_return(('borg', 'list', '--repo', 'repo', 'archive1')) flexmock(module).should_receive('make_list_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=argparse.Namespace( @@ -652,7 +652,7 @@ def test_list_archive_with_find_paths_allows_archive_filter_flag_but_only_passes ).once() module.list_archive( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', list_arguments=argparse.Namespace( diff --git a/tests/unit/borg/test_mount.py b/tests/unit/borg/test_mount.py index 7f2060f..6161a24 100644 --- a/tests/unit/borg/test_mount.py +++ b/tests/unit/borg/test_mount.py @@ -20,7 +20,7 @@ def test_mount_archive_calls_borg_with_required_flags(): insert_execute_command_mock(('borg', 'mount', 'repo', '/mnt')) module.mount_archive( - repository='repo', + repository_path='repo', archive=None, mount_point='/mnt', paths=None, @@ -39,7 +39,7 @@ def test_mount_archive_with_borg_features_calls_borg_with_repository_and_match_a ) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -58,7 +58,7 @@ def test_mount_archive_without_archive_calls_borg_with_repository_flags_only(): insert_execute_command_mock(('borg', 'mount', 'repo::archive', '/mnt')) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -77,7 +77,7 @@ def test_mount_archive_calls_borg_with_path_flags(): insert_execute_command_mock(('borg', 'mount', 'repo::archive', '/mnt', 'path1', 'path2')) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=['path1', 'path2'], @@ -98,7 +98,7 @@ def test_mount_archive_calls_borg_with_remote_path_flags(): ) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -118,7 +118,7 @@ def test_mount_archive_calls_borg_with_umask_flags(): insert_execute_command_mock(('borg', 'mount', '--umask', '0770', 'repo::archive', '/mnt')) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -137,7 +137,7 @@ def test_mount_archive_calls_borg_with_lock_wait_flags(): insert_execute_command_mock(('borg', 'mount', '--lock-wait', '5', 'repo::archive', '/mnt')) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -157,7 +157,7 @@ def test_mount_archive_with_log_info_calls_borg_with_info_parameter(): insert_logging_mock(logging.INFO) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -177,7 +177,7 @@ def test_mount_archive_with_log_debug_calls_borg_with_debug_flags(): insert_logging_mock(logging.DEBUG) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -202,7 +202,7 @@ def test_mount_archive_calls_borg_with_foreground_parameter(): ).once() module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, @@ -221,7 +221,7 @@ def test_mount_archive_calls_borg_with_options_flags(): insert_execute_command_mock(('borg', 'mount', '-o', 'super_mount', 'repo::archive', '/mnt')) module.mount_archive( - repository='repo', + repository_path='repo', archive='archive', mount_point='/mnt', paths=None, diff --git a/tests/unit/borg/test_prune.py b/tests/unit/borg/test_prune.py index dd240dc..f33c993 100644 --- a/tests/unit/borg/test_prune.py +++ b/tests/unit/borg/test_prune.py @@ -98,7 +98,7 @@ def test_prune_archives_calls_borg_with_parameters(): module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, retention_config=flexmock(), local_borg_version='1.2.3', @@ -114,7 +114,7 @@ def test_prune_archives_with_log_info_calls_borg_with_info_parameter(): insert_logging_mock(logging.INFO) module.prune_archives( - repository='repo', + repository_path='repo', storage_config={}, dry_run=False, retention_config=flexmock(), @@ -131,7 +131,7 @@ def test_prune_archives_with_log_debug_calls_borg_with_debug_parameter(): insert_logging_mock(logging.DEBUG) module.prune_archives( - repository='repo', + repository_path='repo', storage_config={}, dry_run=False, retention_config=flexmock(), @@ -147,7 +147,7 @@ def test_prune_archives_with_dry_run_calls_borg_with_dry_run_parameter(): insert_execute_command_mock(PRUNE_COMMAND + ('--dry-run', 'repo'), logging.INFO) module.prune_archives( - repository='repo', + repository_path='repo', storage_config={}, dry_run=True, retention_config=flexmock(), @@ -164,7 +164,7 @@ def test_prune_archives_with_local_path_calls_borg_via_local_path(): module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, retention_config=flexmock(), local_borg_version='1.2.3', @@ -181,7 +181,7 @@ def test_prune_archives_with_remote_path_calls_borg_with_remote_path_parameters( module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, retention_config=flexmock(), local_borg_version='1.2.3', @@ -198,7 +198,7 @@ def test_prune_archives_with_stats_calls_borg_with_stats_parameter_and_answer_ou module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, retention_config=flexmock(), local_borg_version='1.2.3', @@ -215,7 +215,7 @@ def test_prune_archives_with_files_calls_borg_with_list_parameter_and_answer_out module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, retention_config=flexmock(), local_borg_version='1.2.3', @@ -233,7 +233,7 @@ def test_prune_archives_with_umask_calls_borg_with_umask_parameters(): module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config=storage_config, retention_config=flexmock(), local_borg_version='1.2.3', @@ -250,7 +250,7 @@ def test_prune_archives_with_lock_wait_calls_borg_with_lock_wait_parameters(): module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config=storage_config, retention_config=flexmock(), local_borg_version='1.2.3', @@ -266,7 +266,7 @@ def test_prune_archives_with_extra_borg_options_calls_borg_with_extra_options(): module.prune_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={'extra_borg_options': {'prune': '--extra --options'}}, retention_config=flexmock(), local_borg_version='1.2.3', diff --git a/tests/unit/borg/test_rcreate.py b/tests/unit/borg/test_rcreate.py index 612ec11..e232df2 100644 --- a/tests/unit/borg/test_rcreate.py +++ b/tests/unit/borg/test_rcreate.py @@ -40,7 +40,7 @@ def test_create_repository_calls_borg_with_flags(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -55,7 +55,7 @@ def test_create_repository_with_dry_run_skips_borg_call(): module.create_repository( dry_run=True, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -74,7 +74,7 @@ def test_create_repository_raises_for_borg_rcreate_error(): with pytest.raises(subprocess.CalledProcessError): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -88,7 +88,7 @@ def test_create_repository_skips_creation_when_repository_already_exists(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -103,7 +103,7 @@ def test_create_repository_raises_for_unknown_rinfo_command_error(): with pytest.raises(subprocess.CalledProcessError): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -118,7 +118,7 @@ def test_create_repository_with_source_repository_calls_borg_with_other_repo_fla module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -134,7 +134,7 @@ def test_create_repository_with_copy_crypt_key_calls_borg_with_copy_crypt_key_fl module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -150,7 +150,7 @@ def test_create_repository_with_append_only_calls_borg_with_append_only_flag(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -166,7 +166,7 @@ def test_create_repository_with_storage_quota_calls_borg_with_storage_quota_flag module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -182,7 +182,7 @@ def test_create_repository_with_make_parent_dirs_calls_borg_with_make_parent_dir module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -199,7 +199,7 @@ def test_create_repository_with_log_info_calls_borg_with_info_flag(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -215,7 +215,7 @@ def test_create_repository_with_log_debug_calls_borg_with_debug_flag(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -230,7 +230,7 @@ def test_create_repository_with_local_path_calls_borg_via_local_path(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -246,7 +246,7 @@ def test_create_repository_with_remote_path_calls_borg_with_remote_path_flag(): module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', encryption_mode='repokey', @@ -262,7 +262,7 @@ def test_create_repository_with_extra_borg_options_calls_borg_with_extra_options module.create_repository( dry_run=False, - repository='repo', + repository_path='repo', storage_config={'extra_borg_options': {'rcreate': '--extra --options'}}, local_borg_version='2.3.4', encryption_mode='repokey', diff --git a/tests/unit/borg/test_rinfo.py b/tests/unit/borg/test_rinfo.py index d9cbf9b..ec0819c 100644 --- a/tests/unit/borg/test_rinfo.py +++ b/tests/unit/borg/test_rinfo.py @@ -21,7 +21,7 @@ def test_display_repository_info_calls_borg_with_parameters(): ) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -42,7 +42,7 @@ def test_display_repository_info_without_borg_features_calls_borg_with_info_sub_ ) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -63,7 +63,7 @@ def test_display_repository_info_with_log_info_calls_borg_with_info_parameter(): ) insert_logging_mock(logging.INFO) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -82,7 +82,7 @@ def test_display_repository_info_with_log_info_and_json_suppresses_most_borg_out insert_logging_mock(logging.INFO) json_output = module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=True), @@ -106,7 +106,7 @@ def test_display_repository_info_with_log_debug_calls_borg_with_debug_parameter( insert_logging_mock(logging.DEBUG) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -125,7 +125,7 @@ def test_display_repository_info_with_log_debug_and_json_suppresses_most_borg_ou insert_logging_mock(logging.DEBUG) json_output = module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=True), @@ -145,7 +145,7 @@ def test_display_repository_info_with_json_calls_borg_with_json_parameter(): ).and_return('[]') json_output = module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=True), @@ -168,7 +168,7 @@ def test_display_repository_info_with_local_path_calls_borg_via_local_path(): ) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -190,7 +190,7 @@ def test_display_repository_info_with_remote_path_calls_borg_with_remote_path_pa ) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), @@ -213,7 +213,7 @@ def test_display_repository_info_with_lock_wait_calls_borg_with_lock_wait_parame ) module.display_repository_info( - repository='repo', + repository_path='repo', storage_config=storage_config, local_borg_version='2.3.4', rinfo_arguments=flexmock(json=False), diff --git a/tests/unit/borg/test_rlist.py b/tests/unit/borg/test_rlist.py index 178a820..a098caf 100644 --- a/tests/unit/borg/test_rlist.py +++ b/tests/unit/borg/test_rlist.py @@ -131,7 +131,7 @@ def test_make_rlist_command_includes_log_info(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None), @@ -147,7 +147,7 @@ def test_make_rlist_command_includes_json_but_not_info(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=True, prefix=None), @@ -163,7 +163,7 @@ def test_make_rlist_command_includes_log_debug(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None), @@ -179,7 +179,7 @@ def test_make_rlist_command_includes_json_but_not_debug(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=True, prefix=None), @@ -194,7 +194,7 @@ def test_make_rlist_command_includes_json(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=True, prefix=None), @@ -211,7 +211,7 @@ def test_make_rlist_command_includes_lock_wait(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={'lock_wait': 5}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None), @@ -226,7 +226,7 @@ def test_make_rlist_command_includes_local_path(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None), @@ -244,7 +244,7 @@ def test_make_rlist_command_includes_remote_path(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None), @@ -262,7 +262,7 @@ def test_make_rlist_command_transforms_prefix_into_match_archives(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix='foo'), @@ -277,7 +277,7 @@ def test_make_rlist_command_includes_short(): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock(archive=None, paths=None, json=False, prefix=None, short=True), @@ -307,7 +307,7 @@ def test_make_rlist_command_includes_additional_flags(argument_name): flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',)) command = module.make_rlist_command( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=flexmock( @@ -331,7 +331,7 @@ def test_list_repository_calls_borg_with_parameters(): flexmock(module.feature).should_receive('available').and_return(False) flexmock(module).should_receive('make_rlist_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=rlist_arguments, @@ -347,7 +347,7 @@ def test_list_repository_calls_borg_with_parameters(): ).once() module.list_repository( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=rlist_arguments, @@ -362,7 +362,7 @@ def test_list_repository_with_json_returns_borg_output(): flexmock(module.feature).should_receive('available').and_return(False) flexmock(module).should_receive('make_rlist_command').with_args( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=rlist_arguments, @@ -374,7 +374,7 @@ def test_list_repository_with_json_returns_borg_output(): assert ( module.list_repository( - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='1.2.3', rlist_arguments=rlist_arguments, diff --git a/tests/unit/borg/test_transfer.py b/tests/unit/borg/test_transfer.py index 27b0347..a481442 100644 --- a/tests/unit/borg/test_transfer.py +++ b/tests/unit/borg/test_transfer.py @@ -25,7 +25,7 @@ def test_transfer_archives_calls_borg_with_flags(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -54,7 +54,7 @@ def test_transfer_archives_with_dry_run_calls_borg_with_dry_run_flag(): module.transfer_archives( dry_run=True, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -80,7 +80,7 @@ def test_transfer_archives_with_log_info_calls_borg_with_info_flag(): insert_logging_mock(logging.INFO) module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -107,7 +107,7 @@ def test_transfer_archives_with_log_debug_calls_borg_with_debug_flag(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -136,7 +136,7 @@ def test_transfer_archives_with_archive_calls_borg_with_match_archives_flag(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -165,7 +165,7 @@ def test_transfer_archives_with_match_archives_calls_borg_with_match_archives_fl module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -191,7 +191,7 @@ def test_transfer_archives_with_local_path_calls_borg_via_local_path(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -221,7 +221,7 @@ def test_transfer_archives_with_remote_path_calls_borg_with_remote_path_flags(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -252,7 +252,7 @@ def test_transfer_archives_with_lock_wait_calls_borg_with_lock_wait_flags(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config=storage_config, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -278,7 +278,7 @@ def test_transfer_archives_with_progress_calls_borg_with_progress_flag(): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -308,7 +308,7 @@ def test_transfer_archives_passes_through_arguments_to_borg(argument_name): module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock( @@ -340,7 +340,7 @@ def test_transfer_archives_with_source_repository_calls_borg_with_other_repo_fla module.transfer_archives( dry_run=False, - repository='repo', + repository_path='repo', storage_config={}, local_borg_version='2.3.4', transfer_arguments=flexmock(