|
@@ -21,6 +21,9 @@ def insert_execute_command_mock(
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_path_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', 'repo::archive', 'test.tar', 'path1', 'path2')
|
|
@@ -33,10 +36,14 @@ def test_export_tar_archive_calls_borg_with_path_parameters():
|
|
|
paths=['path1', 'path2'],
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_local_path_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg1', 'export-tar', 'repo::archive', 'test.tar'), borg_local_path='borg1'
|
|
@@ -49,11 +56,15 @@ def test_export_tar_archive_calls_borg_with_local_path_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
local_path='borg1',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_remote_path_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--remote-path', 'borg1', 'repo::archive', 'test.tar')
|
|
@@ -66,11 +77,15 @@ def test_export_tar_archive_calls_borg_with_remote_path_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
remote_path='borg1',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_umask_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--umask', '0770', 'repo::archive', 'test.tar')
|
|
@@ -83,10 +98,14 @@ def test_export_tar_archive_calls_borg_with_umask_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={'umask': '0770'},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_lock_wait_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--lock-wait', '5', 'repo::archive', 'test.tar')
|
|
@@ -99,10 +118,14 @@ def test_export_tar_archive_calls_borg_with_lock_wait_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={'lock_wait': '5'},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_with_log_info_calls_borg_with_info_parameter():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(('borg', 'export-tar', '--info', 'repo::archive', 'test.tar'))
|
|
|
insert_logging_mock(logging.INFO)
|
|
@@ -114,10 +137,14 @@ def test_export_tar_archive_with_log_info_calls_borg_with_info_parameter():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_with_log_debug_calls_borg_with_debug_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--debug', '--show-rc', 'repo::archive', 'test.tar')
|
|
@@ -131,10 +158,14 @@ def test_export_tar_archive_with_log_debug_calls_borg_with_debug_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_dry_run_parameter():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
flexmock(module).should_receive('execute_command').never()
|
|
|
|
|
@@ -145,10 +176,14 @@ def test_export_tar_archive_calls_borg_with_dry_run_parameter():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_tar_filter_parameters():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--tar-filter', 'bzip2', 'repo::archive', 'test.tar')
|
|
@@ -161,11 +196,15 @@ def test_export_tar_archive_calls_borg_with_tar_filter_parameters():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
tar_filter='bzip2',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_list_parameter():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--list', 'repo::archive', 'test.tar'),
|
|
@@ -179,11 +218,15 @@ def test_export_tar_archive_calls_borg_with_list_parameter():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
files=True,
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_strip_components_parameter():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(
|
|
|
('borg', 'export-tar', '--strip-components', '5', 'repo::archive', 'test.tar')
|
|
@@ -196,11 +239,15 @@ def test_export_tar_archive_calls_borg_with_strip_components_parameter():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
strip_components=5,
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_skips_abspath_for_remote_repository_parameter():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('server:repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').never()
|
|
|
insert_execute_command_mock(('borg', 'export-tar', 'server:repo::archive', 'test.tar'))
|
|
|
|
|
@@ -211,10 +258,14 @@ def test_export_tar_archive_skips_abspath_for_remote_repository_parameter():
|
|
|
paths=None,
|
|
|
destination_path='test.tar',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|
|
|
|
|
|
|
|
|
def test_export_tar_archive_calls_borg_with_stdout_destination_path():
|
|
|
+ flexmock(module.flags).should_receive('make_repository_archive_flags').and_return(
|
|
|
+ ('repo::archive',)
|
|
|
+ )
|
|
|
flexmock(module.os.path).should_receive('abspath').and_return('repo')
|
|
|
insert_execute_command_mock(('borg', 'export-tar', 'repo::archive', '-'), capture=False)
|
|
|
|
|
@@ -225,4 +276,5 @@ def test_export_tar_archive_calls_borg_with_stdout_destination_path():
|
|
|
paths=None,
|
|
|
destination_path='-',
|
|
|
storage_config={},
|
|
|
+ local_borg_version='1.2.3',
|
|
|
)
|