Add "--repository" flag to common actions (where it makes sense) #652

Merged
witten merged 7 commits from nain/borgmatic:repository-ticket-#564 into master 2023-03-16 20:21:41 +00:00
1 changed files with 1 additions and 23 deletions
Showing only changes of commit ce0ce4cd1c - Show all commits

View File

@ -3,7 +3,7 @@ from flexmock import flexmock
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.borgmatic.borg.prune).should_receive('prune_archives')
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():
witten marked this conversation as resolved
Review

I might suggest combining this test with the previous one, as (unless I'm missing something) their setups are identical besides should_receive('execute_hook') expectation.

I might suggest combining this test with the previous one, as (unless I'm missing something) their setups are identical besides `should_receive('execute_hook')` expectation.
Review

Done.

Done.
flexmock(module.logger).answer = lambda message: None
flexmock(module.borgmatic.config.validate).should_receive('repositories_match').and_return(True)