Align required args for 'fuel2 graph upload'
Dissallow 'fuel2 graph uplod' command execution without
required args (-e ENV | -r RELEASE | -p PLUGIN), e.g.:
usage: fuel2 graph upload [-h]
(-e ENV | -r RELEASE | -p PLUGIN) [-t TYPE] -f FILE
Change-Id: I4fb1215874a849ea032afadb9604fca0dc0784a1
Closes-Bug: 1587837
This commit is contained in:
@@ -59,7 +59,7 @@ class GraphUpload(base.BaseCommand, FileMethodsMixin):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(GraphUpload, self).get_parser(prog_name)
|
||||
graph_class = parser.add_mutually_exclusive_group()
|
||||
graph_class = parser.add_mutually_exclusive_group(required=True)
|
||||
|
||||
graph_class.add_argument('-e',
|
||||
'--env',
|
||||
|
||||
@@ -77,6 +77,13 @@ class TestGraphActions(test_engine.BaseCLITest):
|
||||
)
|
||||
)
|
||||
|
||||
@mock.patch('sys.stderr')
|
||||
def test_upload_fail(self, mocked_stderr):
|
||||
cmd = 'graph upload --file new_graph.yaml'
|
||||
self.assertRaises(SystemExit, self.exec_command, cmd)
|
||||
self.assertIn('-e/--env -r/--release -p/--plugin',
|
||||
mocked_stderr.write.call_args_list[-1][0][0])
|
||||
|
||||
def test_execute(self):
|
||||
self._test_cmd(
|
||||
'execute',
|
||||
|
||||
Reference in New Issue
Block a user