def case_query_handler(): """ @api {get} /v1/case/ 查询 用例 @apiName GetCase @apiGroup 项目 @apiDescription 查询用例,可根据需求id查询 @apiParam {int} [page_size] 分页-单页数目 @apiParam {int} [page_index] 分页-页数 @apiParam {int} [requirement_id] 需求id @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "cnumber": "TC3891", "creation_time": "2019-07-26 16:14:07", "ctype": "1", "id": 3891, "is_auto": 1, "modified_time": "2019-07-26 16:14:07", "module": "看板管理", "moduleid": 342, "precondition": "1", "priority": 0, "requirement":[ { "requirement_id": 1, "requirement_title": "123123", } ], "status": 0, "step_result": "{\"step_result\":[{\"step\":\"1\",\"expect\":\"1\"}]}", "title": "1", "userid": 104, "username": "******" } ], "message": "ok", "page_index": 1, "page_size": 2, "total": 2915 } """ page_size, page_index = parse_list_args2() requirement_id = request.args.get('requirement_id') if requirement_id: data, count = CaseBusiness.query_by_requirement_id( requirement_id, page_size, page_index) else: data, count = CaseBusiness.paginate_data(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def case_query_by_module_id_handler(mid): """ @api {get} /v1/case/querybymodule/mid 查询 单个模块下的用例 @apiName GetCaseByModuleId @apiGroup 项目 @apiDescription 查询单个模块下的用例 @apiParam {int} [page_size] 分页-单页数目 @apiParam {int} [page_index] 分页-页数 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "cnumber": "TC8", "creation_time": "2018-12-19 11:04:57", "ctype": "1", "id": 8, "is_auto": 1, "modified_time": "2018-12-19 11:04:57", "module": "音频", "moduleid": 1, "precondition": "1231321321", "priority": "", "status": 0, "step_result": "{\"step_result\":[{\"step\":\"132\",\"expect\":\"321321321\"}]}", "title": "", "userid": 3, "username": "******" } ], "message": "ok", "page_index": 1, "page_size": 10, "total": 1 } """ page_size = request.args.get('page_size') page_index = request.args.get('page_index') data, count = CaseBusiness.paginate_data(mid=mid, page_size=page_size, page_index=page_index) return json_list_render2(0, data, page_size, page_index, count)