Error if --list is used with --json for create action (#680).

This commit is contained in:
Dan Helfman 2023-05-03 17:16:36 -07:00
parent 0b397a5bf9
commit 359afe5318
2 changed files with 11 additions and 0 deletions

View file

@ -878,6 +878,10 @@ def parse_arguments(*unparsed_arguments):
raise ValueError(
'With the create action, only one of --list (--files) and --progress flags can be used.'
)
if 'create' in arguments and arguments['create'].list_files and arguments['create'].json:
raise ValueError(
'With the create action, only one of --list (--files) and --json flags can be used.'
)
if (
('list' in arguments and 'rinfo' in arguments and arguments['list'].json)

View file

@ -422,6 +422,13 @@ def test_parse_arguments_disallows_list_with_progress_for_create_action():
module.parse_arguments('create', '--list', '--progress')
def test_parse_arguments_disallows_list_with_json_for_create_action():
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
with pytest.raises(ValueError):
module.parse_arguments('create', '--list', '--json')
def test_parse_arguments_allows_json_with_list_or_info():
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])