示例#1
0
def editMockApiBody(apiid):
    try:
        edit_mock_service(apiid, request)
    except Exception as e:
        return response(False, str(e))

    return response()
示例#2
0
def addMock():
    try:
        add_mock_service(request)
    except Exception as e:
        print traceback.format_exc()
        return response(success=False, error=str(e))
    return response()
示例#3
0
def deleteCondition(id):
    condition = Condition.query.filter_by(id=id).first()
    if condition and condition.user_id == current_user.id:
        condition.status = -1
        db.session.add(condition)
        db.session.commit()
        cache.clear()
        return response()
    elif condition:
        return response(False, "只能删除自己创建的mock-api-condition")
    else:
        return response(False, "未配置的mock-api-condition")
示例#4
0
def deleteMock(id):
    api = Api.query.filter_by(id=id).first()
    if api and api.user_id == current_user.id:
        conditions = Condition.query.filter_by(
            user_id=current_user.id).filter_by(api_id=id).all()
        api.status = -1
        db.session.add(api)
        for c in conditions:
            c.status = -1
            db.session.add(c)
        db.session.commit()
        cache.clear()
        return response()
    elif api:
        return response(False, "只能删除自己创建的mock-api")
    else:
        return response(False, "未配置的mock-api")
示例#5
0
def editConditionBody(condition_id):
    try:
        edit_condition_resp(condition_id, request)
    except Exception as e:
        return response(False, str(e))
    return response()