|
@@ -23,8 +23,8 @@ def insert_info_command_not_found_mock():
|
|
|
|
|
|
|
|
|
def insert_init_command_mock(init_command, **kwargs):
|
|
|
- flexmock(module.subprocess).should_receive('check_call').with_args(
|
|
|
- init_command, **kwargs
|
|
|
+ flexmock(module).should_receive('execute_command_without_capture').with_args(
|
|
|
+ init_command
|
|
|
).once()
|
|
|
|
|
|
|
|
@@ -35,18 +35,9 @@ def test_initialize_repository_calls_borg_with_parameters():
|
|
|
module.initialize_repository(repository='repo', encryption_mode='repokey')
|
|
|
|
|
|
|
|
|
-def test_initialize_repository_does_not_raise_for_borg_init_warning():
|
|
|
- insert_info_command_not_found_mock()
|
|
|
- flexmock(module.subprocess).should_receive('check_call').and_raise(
|
|
|
- module.subprocess.CalledProcessError(1, 'borg init')
|
|
|
- )
|
|
|
-
|
|
|
- module.initialize_repository(repository='repo', encryption_mode='repokey')
|
|
|
-
|
|
|
-
|
|
|
def test_initialize_repository_raises_for_borg_init_error():
|
|
|
insert_info_command_not_found_mock()
|
|
|
- flexmock(module.subprocess).should_receive('check_call').and_raise(
|
|
|
+ flexmock(module).should_receive('execute_command_without_capture').and_raise(
|
|
|
module.subprocess.CalledProcessError(2, 'borg init')
|
|
|
)
|
|
|
|
|
@@ -56,7 +47,7 @@ def test_initialize_repository_raises_for_borg_init_error():
|
|
|
|
|
|
def test_initialize_repository_skips_initialization_when_repository_already_exists():
|
|
|
insert_info_command_found_mock()
|
|
|
- flexmock(module.subprocess).should_receive('check_call').never()
|
|
|
+ flexmock(module).should_receive('execute_command_without_capture').never()
|
|
|
|
|
|
module.initialize_repository(repository='repo', encryption_mode='repokey')
|
|
|
|