X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcmd%2Fcommands%2Ftestcase.py;h=a151871b38e1562f21fde813d6de77c7eab57c62;hb=31b02e5b95d8b4076ef60667d051a8a1a6b072ba;hp=6ff79623849119470c5cbe66aa1507992adc25d9;hpb=708550dd0718abdad8862e2275cc8e025a7c55e3;p=yardstick.git diff --git a/yardstick/cmd/commands/testcase.py b/yardstick/cmd/commands/testcase.py index 6ff796238..a151871b3 100644 --- a/yardstick/cmd/commands/testcase.py +++ b/yardstick/cmd/commands/testcase.py @@ -8,24 +8,40 @@ ############################################################################## """ Handler for yardstick command 'testcase' """ +from __future__ import print_function +from __future__ import absolute_import + from yardstick.benchmark.core.testcase import Testcase +from yardstick.benchmark.core import print_hbar from yardstick.common.utils import cliargs from yardstick.cmd.commands import change_osloobj_to_paras +from yardstick.cmd.commands import Commands -class TestcaseCommands(object): - '''Testcase commands. +class TestcaseCommands(Commands): + """Testcase commands. Set of commands to discover and display test cases. - ''' + """ def do_list(self, args): - '''List existing test cases''' - param = change_osloobj_to_paras(args) - Testcase().list_all(param) + """List existing test cases""" + testcase_list = self.client.get('/yardstick/testcases')['result'] + self._format_print(testcase_list) @cliargs("casename", type=str, help="test case name", nargs=1) def do_show(self, args): - '''Show details of a specific test case''' + """Show details of a specific test case""" param = change_osloobj_to_paras(args) Testcase().show(param) + + def _format_print(self, testcase_list): + """format output""" + + print_hbar(88) + print("| %-21s | %-60s" % ("Testcase Name", "Description")) + print_hbar(88) + for testcase_record in testcase_list: + print("| %-16s | %-60s" % (testcase_record['Name'], + testcase_record['Description'])) + print_hbar(88)