|
@@ -142,14 +142,28 @@ def test_parse_arguments_disallows_init_and_dry_run():
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-def test_parse_arguments_disallows_repository_without_extract():
|
|
|
|
|
|
+def test_parse_arguments_disallows_repository_without_extract_or_list():
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
module.parse_arguments('--config', 'myconfig', '--repository', 'test.borg')
|
|
module.parse_arguments('--config', 'myconfig', '--repository', 'test.borg')
|
|
|
|
|
|
|
|
|
|
-def test_parse_arguments_disallows_archive_without_extract():
|
|
|
|
|
|
+def test_parse_arguments_allows_repository_with_extract():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
|
|
+ module.parse_arguments(
|
|
|
|
+ '--config', 'myconfig', '--extract', '--repository', 'test.borg', '--archive', 'test'
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_parse_arguments_allows_repository_with_list():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
|
|
+ module.parse_arguments('--config', 'myconfig', '--list', '--repository', 'test.borg')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_parse_arguments_disallows_archive_without_extract_or_list():
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
@@ -169,6 +183,12 @@ def test_parse_arguments_allows_archive_with_extract():
|
|
module.parse_arguments('--config', 'myconfig', '--extract', '--archive', 'test')
|
|
module.parse_arguments('--config', 'myconfig', '--extract', '--archive', 'test')
|
|
|
|
|
|
|
|
|
|
|
|
+def test_parse_arguments_allows_archive_with_list():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
|
|
+ module.parse_arguments('--config', 'myconfig', '--list', '--archive', 'test')
|
|
|
|
+
|
|
|
|
+
|
|
def test_parse_arguments_requires_archive_with_extract():
|
|
def test_parse_arguments_requires_archive_with_extract():
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
|
|
@@ -177,51 +197,73 @@ def test_parse_arguments_requires_archive_with_extract():
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_allows_progress_and_create():
|
|
def test_parse_arguments_allows_progress_and_create():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--progress', '--create', '--list')
|
|
module.parse_arguments('--progress', '--create', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_allows_progress_and_extract():
|
|
def test_parse_arguments_allows_progress_and_extract():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--progress', '--extract', '--archive', 'test', '--list')
|
|
module.parse_arguments('--progress', '--extract', '--archive', 'test', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_disallows_progress_without_create():
|
|
def test_parse_arguments_disallows_progress_without_create():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
module.parse_arguments('--progress', '--list')
|
|
module.parse_arguments('--progress', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_with_stats_and_create_flags_does_not_raise():
|
|
def test_parse_arguments_with_stats_and_create_flags_does_not_raise():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--stats', '--create', '--list')
|
|
module.parse_arguments('--stats', '--create', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_with_stats_and_prune_flags_does_not_raise():
|
|
def test_parse_arguments_with_stats_and_prune_flags_does_not_raise():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--stats', '--prune', '--list')
|
|
module.parse_arguments('--stats', '--prune', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_with_stats_flag_but_no_create_or_prune_flag_raises_value_error():
|
|
def test_parse_arguments_with_stats_flag_but_no_create_or_prune_flag_raises_value_error():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
module.parse_arguments('--stats', '--list')
|
|
module.parse_arguments('--stats', '--list')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_with_just_stats_flag_does_not_raise():
|
|
def test_parse_arguments_with_just_stats_flag_does_not_raise():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--stats')
|
|
module.parse_arguments('--stats')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_allows_json_with_list_or_info():
|
|
def test_parse_arguments_allows_json_with_list_or_info():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
module.parse_arguments('--list', '--json')
|
|
module.parse_arguments('--list', '--json')
|
|
module.parse_arguments('--info', '--json')
|
|
module.parse_arguments('--info', '--json')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_disallows_json_without_list_or_info():
|
|
def test_parse_arguments_disallows_json_without_list_or_info():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
module.parse_arguments('--json')
|
|
module.parse_arguments('--json')
|
|
|
|
|
|
|
|
|
|
def test_parse_arguments_disallows_json_with_both_list_and_info():
|
|
def test_parse_arguments_disallows_json_with_both_list_and_info():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
with pytest.raises(ValueError):
|
|
with pytest.raises(ValueError):
|
|
module.parse_arguments('--list', '--info', '--json')
|
|
module.parse_arguments('--list', '--info', '--json')
|
|
|
|
|
|
|
|
|
|
def test_borgmatic_version_matches_news_version():
|
|
def test_borgmatic_version_matches_news_version():
|
|
|
|
+ flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
|
|
|
+
|
|
borgmatic_version = subprocess.check_output(('borgmatic', '--version')).decode('ascii')
|
|
borgmatic_version = subprocess.check_output(('borgmatic', '--version')).decode('ascii')
|
|
news_version = open('NEWS').readline()
|
|
news_version = open('NEWS').readline()
|
|
|
|
|