Rename test functions: verbosity -> log level
Also update doc string here and there.
This commit is contained in:
parent
40ee9338f2
commit
c62a93396e
|
@ -75,9 +75,8 @@ def _make_check_flags(checks, check_last=None, prefix=None):
|
|||
|
||||
def check_archives(repository, storage_config, consistency_config, local_path='borg', remote_path=None):
|
||||
'''
|
||||
Given a verbosity flag, a local or remote repository path, a storage config dict, a consistency
|
||||
config dict, and a local/remote commands to run, check the contained Borg archives for
|
||||
consistency.
|
||||
Given a local or remote repository path, a storage config dict, a consistency config dict,
|
||||
and a local/remote commands to run, check the contained Borg archives for consistency.
|
||||
|
||||
If there are no consistency checks to run, skip running them.
|
||||
'''
|
||||
|
|
|
@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def list_archives(repository, storage_config, local_path='borg', remote_path=None, json=False):
|
||||
'''
|
||||
Given a verbosity flag, a local or remote repository path, and a storage config dict,
|
||||
Given a local or remote repository path, and a storage config dict,
|
||||
list Borg archives in the repository.
|
||||
'''
|
||||
lock_wait = storage_config.get('lock_wait', None)
|
||||
|
|
|
@ -146,7 +146,7 @@ def test_check_archives_with_extract_check_calls_extract_only():
|
|||
)
|
||||
|
||||
|
||||
def test_check_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
||||
def test_check_archives_with_log_info_calls_borg_with_info_parameter():
|
||||
checks = ('repository',)
|
||||
consistency_config = {'check_last': None}
|
||||
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
||||
|
@ -164,7 +164,7 @@ def test_check_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_check_archives_with_verbosity_lots_calls_borg_with_debug_parameter():
|
||||
def test_check_archives_with_log_debug_calls_borg_with_debug_parameter():
|
||||
checks = ('repository',)
|
||||
consistency_config = {'check_last': None}
|
||||
flexmock(module).should_receive('_parse_checks').and_return(checks)
|
||||
|
|
|
@ -267,7 +267,7 @@ def test_create_archive_with_exclude_patterns_calls_borg_with_excludes():
|
|||
)
|
||||
|
||||
|
||||
def test_create_archive_with_verbosity_some_calls_borg_with_info_parameter():
|
||||
def test_create_archive_with_log_info_calls_borg_with_info_parameter():
|
||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar')).and_return(())
|
||||
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
||||
flexmock(module).should_receive('_make_pattern_flags').and_return(())
|
||||
|
@ -288,7 +288,7 @@ def test_create_archive_with_verbosity_some_calls_borg_with_info_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_create_archive_with_verbosity_lots_calls_borg_with_debug_parameter():
|
||||
def test_create_archive_with_log_debug_calls_borg_with_debug_parameter():
|
||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar')).and_return(())
|
||||
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
||||
flexmock(module).should_receive('_make_pattern_flags').and_return(())
|
||||
|
@ -328,7 +328,7 @@ def test_create_archive_with_dry_run_calls_borg_with_dry_run_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_create_archive_with_dry_run_and_verbosity_some_calls_borg_without_stats_parameter():
|
||||
def test_create_archive_with_dry_run_and_log_info_calls_borg_without_stats_parameter():
|
||||
""" --dry-run and --stats are mutually exclusive, see:
|
||||
https://borgbackup.readthedocs.io/en/stable/usage/create.html#description """
|
||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar')).and_return(())
|
||||
|
@ -351,7 +351,7 @@ def test_create_archive_with_dry_run_and_verbosity_some_calls_borg_without_stats
|
|||
)
|
||||
|
||||
|
||||
def test_create_archive_with_dry_run_and_verbosity_lots_calls_borg_without_stats_parameter():
|
||||
def test_create_archive_with_dry_run_and_log_debug_calls_borg_without_stats_parameter():
|
||||
""" --dry-run and --stats are mutually exclusive, see:
|
||||
https://borgbackup.readthedocs.io/en/stable/usage/create.html#description """
|
||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar')).and_return(())
|
||||
|
|
|
@ -52,7 +52,7 @@ def test_extract_last_archive_dry_run_without_any_archives_should_bail():
|
|||
)
|
||||
|
||||
|
||||
def test_extract_last_archive_dry_run_with_verbosity_some_should_call_borg_with_info_parameter():
|
||||
def test_extract_last_archive_dry_run_with_log_info_should_call_borg_with_info_parameter():
|
||||
flexmock(sys.stdout).encoding = 'utf-8'
|
||||
insert_subprocess_check_output_mock(
|
||||
('borg', 'list', '--short', 'repo', '--info'),
|
||||
|
@ -69,7 +69,7 @@ def test_extract_last_archive_dry_run_with_verbosity_some_should_call_borg_with_
|
|||
)
|
||||
|
||||
|
||||
def test_extract_last_archive_dry_run_with_verbosity_lots_should_call_borg_with_debug_parameter():
|
||||
def test_extract_last_archive_dry_run_with_log_debug_should_call_borg_with_debug_parameter():
|
||||
flexmock(sys.stdout).encoding = 'utf-8'
|
||||
insert_subprocess_check_output_mock(
|
||||
('borg', 'list', '--short', 'repo', '--debug', '--show-rc'),
|
||||
|
|
|
@ -24,7 +24,7 @@ def test_display_archives_info_calls_borg_with_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_display_archives_info_with_verbosity_some_calls_borg_with_info_parameter():
|
||||
def test_display_archives_info_with_log_info_calls_borg_with_info_parameter():
|
||||
insert_subprocess_mock(INFO_COMMAND + ('--info',))
|
||||
insert_logging_mock(logging.INFO)
|
||||
module.display_archives_info(
|
||||
|
@ -33,7 +33,7 @@ def test_display_archives_info_with_verbosity_some_calls_borg_with_info_paramete
|
|||
)
|
||||
|
||||
|
||||
def test_display_archives_info_with_verbosity_lots_calls_borg_with_debug_parameter():
|
||||
def test_display_archives_info_with_log_debug_calls_borg_with_debug_parameter():
|
||||
insert_subprocess_mock(INFO_COMMAND + ('--debug', '--show-rc'))
|
||||
insert_logging_mock(logging.DEBUG)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ def test_list_archives_calls_borg_with_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_list_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
||||
def test_list_archives_with_log_info_calls_borg_with_info_parameter():
|
||||
insert_subprocess_mock(LIST_COMMAND + ('--info',))
|
||||
insert_logging_mock(logging.INFO)
|
||||
|
||||
|
@ -34,7 +34,7 @@ def test_list_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_list_archives_with_verbosity_lots_calls_borg_with_debug_parameter():
|
||||
def test_list_archives_with_log_debug_calls_borg_with_debug_parameter():
|
||||
insert_subprocess_mock(LIST_COMMAND + ('--debug', '--show-rc'))
|
||||
insert_logging_mock(logging.DEBUG)
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ def test_prune_archives_calls_borg_with_parameters():
|
|||
)
|
||||
|
||||
|
||||
def test_prune_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
||||
def test_prune_archives_with_log_info_calls_borg_with_info_parameter():
|
||||
retention_config = flexmock()
|
||||
flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return(
|
||||
BASE_PRUNE_FLAGS,
|
||||
|
@ -88,7 +88,7 @@ def test_prune_archives_with_verbosity_some_calls_borg_with_info_parameter():
|
|||
)
|
||||
|
||||
|
||||
def test_prune_archives_with_verbosity_lots_calls_borg_with_debug_parameter():
|
||||
def test_prune_archives_with_log_debug_calls_borg_with_debug_parameter():
|
||||
retention_config = flexmock()
|
||||
flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return(
|
||||
BASE_PRUNE_FLAGS,
|
||||
|
|
Loading…
Reference in New Issue