()
return jsonify({'status': 1, 'total': total, 'data': current_set, 'all_set': all_set})
查找用例集合
查找用例集合
查找用例集合
def find_set():
    """ 查找用例集合 """
    data = request.json
    page = data.get('page') if data.get('page') else 1
    per_page = data.get('sizePage') if data.get('sizePage') else 10
    project_id = data.get('projectId')
    if not project_id:
        return jsonify({'msg': '请先创建属于自己的项目', 'status': 0})

    # all_sets = Project.query.filter_by(id=project_id).first().case_sets
    all_sets = CaseSet.query.filter_by(project_id=project_id)
    pagination = all_sets.paginate(page, per_page=per_page, error_out=False)
    _items = pagination.items
    total = pagination.total
    current_set = [{'label': s.name, 'id': s.id} for s in _items]
    all_set = [{'label': s.name, 'id': s.id} for s in all_sets.all()]
    return jsonify({'status': 1, 'total': total, 'data': current_set, 'all_set': all_set})
def find_set ( ) : data = request . json page = data . get ( 'page' ) if data . get ( 'page' ) else 1 per_page = data . get ( 'sizePage' ) if data . get ( 'sizePage' ) else 10 project_id = data . get ( 'projectId' ) if not project_id : return jsonify ( { 'msg' : '请先创建属于自己的项目', 'status': 0}) # all_sets = Project.query.filter_by(id=project_id).first().case_sets all_sets = CaseSet . query . filter_by ( project_id = project_id ) pagination = all_sets . paginate ( page , per_page = per_page , error_out = False ) _items = pagination . items total = pagination . total current_set = [ { 'label' : s . name , 'id' : s . id } for s in _items ] all_set = [ { 'label' : s . name , 'id' : s . id } for s in all_sets . all ( ) ] return jsonify ( { 'status' : 1 , 'total' : total , 'data' : current_set , 'all_set' : all_set } )