Error if --list is used with --json for create action (#680).
This commit is contained in:
parent
0b397a5bf9
commit
359afe5318
2 changed files with 11 additions and 0 deletions
|
@ -878,6 +878,10 @@ def parse_arguments(*unparsed_arguments):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'With the create action, only one of --list (--files) and --progress flags can be used.'
|
'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 (
|
if (
|
||||||
('list' in arguments and 'rinfo' in arguments and arguments['list'].json)
|
('list' in arguments and 'rinfo' in arguments and arguments['list'].json)
|
||||||
|
|
|
@ -422,6 +422,13 @@ def test_parse_arguments_disallows_list_with_progress_for_create_action():
|
||||||
module.parse_arguments('create', '--list', '--progress')
|
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():
|
def test_parse_arguments_allows_json_with_list_or_info():
|
||||||
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue