4 from api import ApiResource
5 from yardstick.common.utils import result_handler
6 from yardstick.common import constants as consts
7 from yardstick.benchmark.core import Param
8 from yardstick.benchmark.core.testcase import Testcase
10 LOG = logging.getLogger(__name__)
11 LOG.setLevel(logging.DEBUG)
14 class V2Testcases(ApiResource):
18 testcase_list = Testcase().list_all(param)
19 return result_handler(consts.API_SUCCESS, testcase_list)
22 return self._dispatch_post()
24 def upload_case(self, args):
26 upload_file = args['file']
28 return result_handler(consts.API_ERROR, 'file must be provided')
30 case_name = os.path.join(consts.TESTCASE_DIR, upload_file.filename)
32 LOG.info('save case file')
33 upload_file.save(case_name)
35 return result_handler(consts.API_SUCCESS, {'testcase': upload_file.filename})