|
@@ -87,7 +87,7 @@ def test_make_check_flags_with_default_checks_and_last_returns_last_flag():
|
|
('repository', 'archives', 'other'),
|
|
('repository', 'archives', 'other'),
|
|
),
|
|
),
|
|
)
|
|
)
|
|
-def test_check_archives_should_call_borg_with_parameters(checks):
|
|
|
|
|
|
+def test_check_archives_calls_borg_with_parameters(checks):
|
|
check_last = flexmock()
|
|
check_last = flexmock()
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
@@ -107,7 +107,7 @@ def test_check_archives_should_call_borg_with_parameters(checks):
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_check_archives_with_extract_check_should_call_extract_only():
|
|
|
|
|
|
+def test_check_archives_with_extract_check_calls_extract_only():
|
|
checks = ('extract',)
|
|
checks = ('extract',)
|
|
check_last = flexmock()
|
|
check_last = flexmock()
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
@@ -123,7 +123,7 @@ def test_check_archives_with_extract_check_should_call_extract_only():
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_check_archives_with_verbosity_some_should_call_borg_with_info_parameter():
|
|
|
|
|
|
+def test_check_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
|
checks = ('repository',)
|
|
checks = ('repository',)
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
@@ -140,7 +140,7 @@ def test_check_archives_with_verbosity_some_should_call_borg_with_info_parameter
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_check_archives_with_verbosity_lots_should_call_borg_with_debug_parameter():
|
|
|
|
|
|
+def test_check_archives_with_verbosity_lots_calls_borg_with_debug_parameter():
|
|
checks = ('repository',)
|
|
checks = ('repository',)
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
@@ -157,7 +157,7 @@ def test_check_archives_with_verbosity_lots_should_call_borg_with_debug_paramete
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_check_archives_without_any_checks_should_bail():
|
|
|
|
|
|
+def test_check_archives_without_any_checks_bails():
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(None).mock
|
|
flexmock(module).should_receive('_parse_checks').and_return(())
|
|
flexmock(module).should_receive('_parse_checks').and_return(())
|
|
insert_subprocess_never()
|
|
insert_subprocess_never()
|
|
@@ -169,7 +169,29 @@ def test_check_archives_without_any_checks_should_bail():
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_check_archives_with_remote_path_should_call_borg_with_remote_path_parameters():
|
|
|
|
|
|
+def test_check_archives_with_local_path_calls_borg_via_local_path():
|
|
|
|
+ checks = ('repository',)
|
|
|
|
+ check_last = flexmock()
|
|
|
|
+ consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
|
|
+ flexmock(module).should_receive('_parse_checks').and_return(checks)
|
|
|
|
+ flexmock(module).should_receive('_make_check_flags').with_args(checks, check_last).and_return(())
|
|
|
|
+ stdout = flexmock()
|
|
|
|
+ insert_subprocess_mock(
|
|
|
|
+ ('borg1', 'check', 'repo'),
|
|
|
|
+ stdout=stdout, stderr=STDOUT,
|
|
|
|
+ )
|
|
|
|
+ flexmock(sys.modules['builtins']).should_receive('open').and_return(stdout)
|
|
|
|
+ flexmock(module.os).should_receive('devnull')
|
|
|
|
+
|
|
|
|
+ module.check_archives(
|
|
|
|
+ verbosity=None,
|
|
|
|
+ repository='repo',
|
|
|
|
+ consistency_config=consistency_config,
|
|
|
|
+ local_path='borg1',
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_check_archives_with_remote_path_calls_borg_with_remote_path_parameters():
|
|
checks = ('repository',)
|
|
checks = ('repository',)
|
|
check_last = flexmock()
|
|
check_last = flexmock()
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|
|
consistency_config = flexmock().should_receive('get').and_return(check_last).mock
|