Merge mostly repetetive tests

This commit is contained in:
Nain 2023-03-16 08:23:21 -04:00
parent 7de9260b0d
commit ce0ce4cd1c

View file

@ -3,7 +3,7 @@ from flexmock import flexmock
from borgmatic.actions import prune as module from borgmatic.actions import prune as module
def test_run_prune_calls_hooks(): def test_run_prune_calls_hooks_of_configured_repository():
flexmock(module.logger).answer = lambda message: None flexmock(module.logger).answer = lambda message: None
flexmock(module.borgmatic.borg.prune).should_receive('prune_archives') flexmock(module.borgmatic.borg.prune).should_receive('prune_archives')
flexmock(module.borgmatic.hooks.command).should_receive('execute_hook').times(2) flexmock(module.borgmatic.hooks.command).should_receive('execute_hook').times(2)
@ -26,28 +26,6 @@ def test_run_prune_calls_hooks():
) )
def test_run_prune_runs_with_no_explicit_repository():
flexmock(module.logger).answer = lambda message: None
flexmock(module.borgmatic.borg.prune).should_receive('prune_archives')
prune_arguments = flexmock(repository=None, stats=flexmock(), list_archives=flexmock())
global_arguments = flexmock(monitoring_verbosity=1, dry_run=False)
module.run_prune(
config_filename='test.yaml',
repository='repo',
storage={},
retention={},
hooks={},
hook_context={},
local_borg_version=None,
prune_arguments=prune_arguments,
global_arguments=global_arguments,
dry_run_label='',
local_path=None,
remote_path=None,
)
def test_run_prune_runs_with_select_repository(): def test_run_prune_runs_with_select_repository():
flexmock(module.logger).answer = lambda message: None flexmock(module.logger).answer = lambda message: None
flexmock(module.borgmatic.config.validate).should_receive('repositories_match').and_return(True) flexmock(module.borgmatic.config.validate).should_receive('repositories_match').and_return(True)