|
@@ -18,6 +18,7 @@ def test_transfer_archives_calls_borg_with_flags():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -27,7 +28,9 @@ def test_transfer_archives_calls_borg_with_flags():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -44,6 +47,7 @@ def test_transfer_archives_with_dry_run_calls_borg_with_dry_run_flag():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--repo', 'repo', '--dry-run'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -53,7 +57,9 @@ def test_transfer_archives_with_dry_run_calls_borg_with_dry_run_flag():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -67,6 +73,7 @@ def test_transfer_archives_with_log_info_calls_borg_with_info_flag():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--info', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -76,7 +83,9 @@ def test_transfer_archives_with_log_info_calls_borg_with_info_flag():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -90,6 +99,7 @@ def test_transfer_archives_with_log_debug_calls_borg_with_debug_flag():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--debug', '--show-rc', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -100,7 +110,9 @@ def test_transfer_archives_with_log_debug_calls_borg_with_debug_flag():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -117,6 +129,7 @@ def test_transfer_archives_with_archive_calls_borg_with_match_archives_flag():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--match-archives', 'archive', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -126,7 +139,9 @@ def test_transfer_archives_with_archive_calls_borg_with_match_archives_flag():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive='archive', match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive='archive', progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -143,6 +158,7 @@ def test_transfer_archives_with_match_archives_calls_borg_with_match_archives_fl
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--match-archives', 'sh:foo*', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -152,7 +168,9 @@ def test_transfer_archives_with_match_archives_calls_borg_with_match_archives_fl
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives='sh:foo*', source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives='sh:foo*', source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -166,6 +184,7 @@ def test_transfer_archives_with_local_path_calls_borg_via_local_path():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg2', 'transfer', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg2',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -175,7 +194,9 @@ def test_transfer_archives_with_local_path_calls_borg_via_local_path():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
local_path='borg2',
|
|
|
)
|
|
|
|
|
@@ -193,6 +214,7 @@ def test_transfer_archives_with_remote_path_calls_borg_with_remote_path_flags():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--remote-path', 'borg2', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -202,7 +224,9 @@ def test_transfer_archives_with_remote_path_calls_borg_with_remote_path_flags():
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
remote_path='borg2',
|
|
|
)
|
|
|
|
|
@@ -221,6 +245,7 @@ def test_transfer_archives_with_lock_wait_calls_borg_with_lock_wait_flags():
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--lock-wait', '5', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -230,7 +255,35 @@ def test_transfer_archives_with_lock_wait_calls_borg_with_lock_wait_flags():
|
|
|
repository='repo',
|
|
|
storage_config=storage_config,
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository=None),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_transfer_archives_with_progress_calls_borg_with_progress_flag():
|
|
|
+ flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
|
|
|
+ flexmock(module.logging).ANSWER = module.borgmatic.logger.ANSWER
|
|
|
+ flexmock(module.flags).should_receive('make_flags').and_return(())
|
|
|
+ flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
|
|
|
+ flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
|
|
|
+ flexmock(module.environment).should_receive('make_environment')
|
|
|
+ flexmock(module).should_receive('execute_command').with_args(
|
|
|
+ ('borg', 'transfer', '--progress', '--repo', 'repo'),
|
|
|
+ output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=module.DO_NOT_CAPTURE,
|
|
|
+ borg_local_path='borg',
|
|
|
+ extra_environment=None,
|
|
|
+ )
|
|
|
+
|
|
|
+ module.transfer_archives(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ storage_config={},
|
|
|
+ local_borg_version='2.3.4',
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=True, match_archives=None, source_repository=None
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -248,6 +301,7 @@ def test_transfer_archives_passes_through_arguments_to_borg(argument_name):
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', flag_name, 'value', '--repo', 'repo'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -258,7 +312,11 @@ def test_transfer_archives_passes_through_arguments_to_borg(argument_name):
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
transfer_arguments=flexmock(
|
|
|
- archive=None, match_archives=None, source_repository=None, **{argument_name: 'value'}
|
|
|
+ archive=None,
|
|
|
+ progress=None,
|
|
|
+ match_archives=None,
|
|
|
+ source_repository=None,
|
|
|
+ **{argument_name: 'value'},
|
|
|
),
|
|
|
)
|
|
|
|
|
@@ -275,6 +333,7 @@ def test_transfer_archives_with_source_repository_calls_borg_with_other_repo_fla
|
|
|
flexmock(module).should_receive('execute_command').with_args(
|
|
|
('borg', 'transfer', '--repo', 'repo', '--other-repo', 'other'),
|
|
|
output_log_level=module.borgmatic.logger.ANSWER,
|
|
|
+ output_file=None,
|
|
|
borg_local_path='borg',
|
|
|
extra_environment=None,
|
|
|
)
|
|
@@ -284,5 +343,7 @@ def test_transfer_archives_with_source_repository_calls_borg_with_other_repo_fla
|
|
|
repository='repo',
|
|
|
storage_config={},
|
|
|
local_borg_version='2.3.4',
|
|
|
- transfer_arguments=flexmock(archive=None, match_archives=None, source_repository='other'),
|
|
|
+ transfer_arguments=flexmock(
|
|
|
+ archive=None, progress=None, match_archives=None, source_repository='other'
|
|
|
+ ),
|
|
|
)
|