Align parameters of 'fuel2 graph download' command

Now 'fuel2 graph download' command can be executed without
specifying any task level parameters that leads to erroneous
behavior, i.e. plugins task level graph is downloading by default.
This patch fixes such behavior and makes task level parameters
mandatory, e.g.:
       fuel2 graph download [-h] -e ENV (-a | -c | -p | -r)
                            [-t GRAPH_TYPE] [-f FILE]

Change-Id: I5ed561cda9b0d35043822d01b6bb0b37df451fcb
This commit is contained in:
tivaliy 2016-10-25 22:09:44 +03:00
parent 149be0d7c6
commit 8702619427
2 changed files with 8 additions and 1 deletions

View File

@ -203,7 +203,7 @@ class GraphDownload(base.BaseCommand):
def get_parser(self, prog_name):
parser = super(GraphDownload, self).get_parser(prog_name)
tasks_level = parser.add_mutually_exclusive_group()
tasks_level = parser.add_mutually_exclusive_group(required=True)
parser.add_argument('-e',
'--env',
type=int,

View File

@ -285,6 +285,13 @@ class TestGraphActions(test_engine.BaseCLITest):
)
)
@mock.patch('sys.stderr')
def test_download_fail(self, mocked_stderr):
cmd = 'graph download --env 1'
self.assertRaises(SystemExit, self.exec_command, cmd)
self.assertIn('-a/--all -c/--cluster -p/--plugins -r/--release',
mocked_stderr.write.call_args_list[-1][0][0])
def test_list(self):
with mock.patch('sys.stdout', new=six.moves.cStringIO()) as m_stdout:
self.m_get_client.reset_mock()