Deprecate generate-borgmatic-config in favor if new "config generate" action (#529).
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -1,25 +1,9 @@
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.commands import generate_config as module
|
||||
|
||||
|
||||
def test_parse_arguments_with_no_arguments_uses_default_destination():
|
||||
parser = module.parse_arguments()
|
||||
def test_main_does_not_raise():
|
||||
flexmock(module.borgmatic.commands.borgmatic).should_receive('main')
|
||||
|
||||
assert parser.destination_filename == module.DEFAULT_DESTINATION_CONFIG_FILENAME
|
||||
|
||||
|
||||
def test_parse_arguments_with_destination_argument_overrides_default():
|
||||
parser = module.parse_arguments('--destination', 'config.yaml')
|
||||
|
||||
assert parser.destination_filename == 'config.yaml'
|
||||
|
||||
|
||||
def test_parse_arguments_parses_source():
|
||||
parser = module.parse_arguments('--source', 'source.yaml', '--destination', 'config.yaml')
|
||||
|
||||
assert parser.source_filename == 'source.yaml'
|
||||
|
||||
|
||||
def test_parse_arguments_parses_overwrite():
|
||||
parser = module.parse_arguments('--destination', 'config.yaml', '--overwrite')
|
||||
|
||||
assert parser.overwrite
|
||||
module.main()
|
||||
|
||||
@@ -210,7 +210,7 @@ def test_generate_sample_configuration_does_not_raise():
|
||||
flexmock(module).should_receive('_comment_out_optional_configuration')
|
||||
flexmock(module).should_receive('write_configuration')
|
||||
|
||||
module.generate_sample_configuration(None, 'dest.yaml', 'schema.yaml')
|
||||
module.generate_sample_configuration(False, None, 'dest.yaml', 'schema.yaml')
|
||||
|
||||
|
||||
def test_generate_sample_configuration_with_source_filename_does_not_raise():
|
||||
@@ -225,4 +225,17 @@ def test_generate_sample_configuration_with_source_filename_does_not_raise():
|
||||
flexmock(module).should_receive('_comment_out_optional_configuration')
|
||||
flexmock(module).should_receive('write_configuration')
|
||||
|
||||
module.generate_sample_configuration('source.yaml', 'dest.yaml', 'schema.yaml')
|
||||
module.generate_sample_configuration(False, 'source.yaml', 'dest.yaml', 'schema.yaml')
|
||||
|
||||
|
||||
def test_generate_sample_configuration_with_dry_run_does_not_write_file():
|
||||
builtins = flexmock(sys.modules['builtins'])
|
||||
builtins.should_receive('open').with_args('schema.yaml').and_return('')
|
||||
flexmock(module.yaml).should_receive('round_trip_load')
|
||||
flexmock(module).should_receive('_schema_to_sample_configuration')
|
||||
flexmock(module).should_receive('merge_source_configuration_into_destination')
|
||||
flexmock(module).should_receive('render_configuration')
|
||||
flexmock(module).should_receive('_comment_out_optional_configuration')
|
||||
flexmock(module).should_receive('write_configuration').never()
|
||||
|
||||
module.generate_sample_configuration(True, None, 'dest.yaml', 'schema.yaml')
|
||||
|
||||
Reference in New Issue
Block a user