|
@@ -24,7 +24,7 @@ def insert_subprocess_check_output_mock(check_output_command, result, **kwargs):
|
|
|
).once()
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_should_call_borg_with_last_archive():
|
|
|
+def test_extract_last_archive_dry_run_calls_borg_with_last_archive():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg', 'list', '--short', 'repo'), result='archive1\narchive2\n'.encode('utf-8')
|
|
@@ -44,7 +44,7 @@ def test_extract_last_archive_dry_run_without_any_archives_should_bail():
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=None)
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_with_log_info_should_call_borg_with_info_parameter():
|
|
|
+def test_extract_last_archive_dry_run_with_log_info_calls_borg_with_info_parameter():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg', 'list', '--short', 'repo', '--info'), result='archive1\narchive2\n'.encode('utf-8')
|
|
@@ -55,7 +55,7 @@ def test_extract_last_archive_dry_run_with_log_info_should_call_borg_with_info_p
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=None)
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_with_log_debug_should_call_borg_with_debug_parameter():
|
|
|
+def test_extract_last_archive_dry_run_with_log_debug_calls_borg_with_debug_parameter():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg', 'list', '--short', 'repo', '--debug', '--show-rc'),
|
|
@@ -69,7 +69,7 @@ def test_extract_last_archive_dry_run_with_log_debug_should_call_borg_with_debug
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=None)
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_should_call_borg_via_local_path():
|
|
|
+def test_extract_last_archive_dry_run_calls_borg_via_local_path():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg1', 'list', '--short', 'repo'), result='archive1\narchive2\n'.encode('utf-8')
|
|
@@ -79,7 +79,7 @@ def test_extract_last_archive_dry_run_should_call_borg_via_local_path():
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=None, local_path='borg1')
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_should_call_borg_with_remote_path_parameters():
|
|
|
+def test_extract_last_archive_dry_run_calls_borg_with_remote_path_parameters():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg', 'list', '--short', 'repo', '--remote-path', 'borg1'),
|
|
@@ -92,7 +92,7 @@ def test_extract_last_archive_dry_run_should_call_borg_with_remote_path_paramete
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=None, remote_path='borg1')
|
|
|
|
|
|
|
|
|
-def test_extract_last_archive_dry_run_should_call_borg_with_lock_wait_parameters():
|
|
|
+def test_extract_last_archive_dry_run_calls_borg_with_lock_wait_parameters():
|
|
|
flexmock(sys.stdout).encoding = 'utf-8'
|
|
|
insert_subprocess_check_output_mock(
|
|
|
('borg', 'list', '--short', 'repo', '--lock-wait', '5'),
|
|
@@ -101,3 +101,79 @@ def test_extract_last_archive_dry_run_should_call_borg_with_lock_wait_parameters
|
|
|
insert_subprocess_mock(('borg', 'extract', '--dry-run', 'repo::archive2', '--lock-wait', '5'))
|
|
|
|
|
|
module.extract_last_archive_dry_run(repository='repo', lock_wait=5)
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_calls_borg_with_remote_path_parameters():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--remote-path', 'borg1'))
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ archive='archive',
|
|
|
+ restore_paths=None,
|
|
|
+ storage_config={},
|
|
|
+ remote_path='borg1',
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_calls_borg_with_umask_parameters():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--umask', '0770'))
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ archive='archive',
|
|
|
+ restore_paths=None,
|
|
|
+ storage_config={'umask': '0770'},
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_calls_borg_with_lock_wait_parameters():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--lock-wait', '5'))
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ archive='archive',
|
|
|
+ restore_paths=None,
|
|
|
+ storage_config={'lock_wait': '5'},
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_with_log_info_calls_borg_with_info_parameter():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--info'))
|
|
|
+ insert_logging_mock(logging.INFO)
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False, repository='repo', archive='archive', restore_paths=None, storage_config={}
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_with_log_debug_calls_borg_with_debug_parameters():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--debug', '--list', '--show-rc'))
|
|
|
+ insert_logging_mock(logging.DEBUG)
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False, repository='repo', archive='archive', restore_paths=None, storage_config={}
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_calls_borg_with_dry_run_parameter():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--dry-run'))
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=True, repository='repo', archive='archive', restore_paths=None, storage_config={}
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def test_extract_archive_calls_borg_with_progress_parameter():
|
|
|
+ insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--progress'))
|
|
|
+
|
|
|
+ module.extract_archive(
|
|
|
+ dry_run=False,
|
|
|
+ repository='repo',
|
|
|
+ archive='archive',
|
|
|
+ restore_paths=None,
|
|
|
+ storage_config={},
|
|
|
+ progress=True,
|
|
|
+ )
|