mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-22 02:03:01 +02:00
More test changes.
This commit is contained in:
@@ -2689,3 +2689,27 @@ def test_get_singular_option_value_with_no_config_returns_none():
|
||||
)
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
def test_run_actions_runs_diff():
|
||||
flexmock(module).should_receive('add_custom_log_levels')
|
||||
flexmock(module).should_receive('get_skip_actions').and_return([])
|
||||
flexmock(module.borgmatic.config.validate).should_receive('repositories_match').never()
|
||||
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(
|
||||
flexmock(),
|
||||
)
|
||||
flexmock(module.command).should_receive('Before_after_hooks').and_return(flexmock())
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
tuple(
|
||||
module.run_actions(
|
||||
arguments={'global': flexmock(dry_run=False), 'diff': flexmock()},
|
||||
config_filename=flexmock(),
|
||||
config={'repositories': []},
|
||||
config_paths=[],
|
||||
local_path=flexmock(),
|
||||
remote_path=flexmock(),
|
||||
local_borg_version=flexmock(),
|
||||
repository={'path': 'repo'},
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
from flexmock import flexmock
|
||||
|
||||
import borgmatic.actions.diff
|
||||
import borgmatic.commands.borgmatic as module
|
||||
|
||||
|
||||
def test_run_configuration_with_diff_action_calls_run_diff():
|
||||
config = {'repositories': [{'path': 'foo'}]}
|
||||
arguments = {
|
||||
'global': flexmock(dry_run=False, monitoring_verbosity=0),
|
||||
'diff': flexmock(
|
||||
archive='archive1',
|
||||
same_chunker_params=False,
|
||||
sort_keys=[],
|
||||
content_only=False,
|
||||
second_archive=None,
|
||||
only_patterns=False,
|
||||
),
|
||||
}
|
||||
flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
|
||||
flexmock(module.dispatch).should_receive('call_hooks')
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
|
||||
|
||||
|
||||
def test_run_configuration_with_diff_action_and_verbose_calls_run_diff():
|
||||
config = {'repositories': [{'path': 'foo'}]}
|
||||
arguments = {
|
||||
'global': flexmock(dry_run=False, monitoring_verbosity=1),
|
||||
'diff': flexmock(
|
||||
archive='archive1',
|
||||
same_chunker_params=False,
|
||||
sort_keys=[],
|
||||
content_only=False,
|
||||
second_archive=None,
|
||||
only_patterns=False,
|
||||
),
|
||||
}
|
||||
flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
|
||||
config = {'repositories': [{'path': 'foo'}]}
|
||||
arguments = {
|
||||
'global': flexmock(dry_run=False, monitoring_verbosity=1),
|
||||
'diff': flexmock(
|
||||
archive='archive1',
|
||||
same_chunker_params=False,
|
||||
sort_keys=[],
|
||||
content_only=False,
|
||||
second_archive=None,
|
||||
only_patterns=False,
|
||||
),
|
||||
}
|
||||
flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
|
||||
@@ -1,64 +0,0 @@
|
||||
from flexmock import flexmock
|
||||
|
||||
import borgmatic.actions.diff
|
||||
import borgmatic.commands.borgmatic as module
|
||||
|
||||
|
||||
def test_run_actions_with_diff_calls_diff_action():
|
||||
config = {'repositories': [{'path': 'foo'}]}
|
||||
arguments = {
|
||||
'global': flexmock(dry_run=False),
|
||||
'diff': flexmock(
|
||||
archive='archive1',
|
||||
same_chunker_params=False,
|
||||
sort_keys=[],
|
||||
content_only=False,
|
||||
second_archive=None,
|
||||
only_patterns=False,
|
||||
),
|
||||
}
|
||||
flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
list(
|
||||
module.run_actions(
|
||||
arguments=arguments,
|
||||
config_filename='test.yaml',
|
||||
config=config,
|
||||
config_paths=[],
|
||||
local_path=None,
|
||||
remote_path=None,
|
||||
local_borg_version=None,
|
||||
repository={'path': 'foo'},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_run_actions_with_diff_and_dry_run_calls_diff_action():
|
||||
config = {'repositories': [{'path': 'foo'}]}
|
||||
arguments = {
|
||||
'global': flexmock(dry_run=True),
|
||||
'diff': flexmock(
|
||||
archive='archive1',
|
||||
same_chunker_params=False,
|
||||
sort_keys=[],
|
||||
content_only=False,
|
||||
second_archive=None,
|
||||
only_patterns=False,
|
||||
),
|
||||
}
|
||||
flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
|
||||
flexmock(borgmatic.actions.diff).should_receive('run_diff').once()
|
||||
|
||||
list(
|
||||
module.run_actions(
|
||||
arguments=arguments,
|
||||
config_filename='test.yaml',
|
||||
config=config,
|
||||
config_paths=[],
|
||||
local_path=None,
|
||||
remote_path=None,
|
||||
local_borg_version=None,
|
||||
repository={'path': 'foo'},
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user