Exemplo n.º 1
0
def delete_challenge(jwt, challenge_id):
    error = False
    try:
        challenge = Challenge.query.get(challenge_id)
        if challenge is None:
            error = True
        else:
            DBHelper.delete(challenge)
    except:
        DBHelper.rollback()
        error = True
    finally:
        DBHelper.close()
    if error:
        abort(404)
    return jsonify({"success": True})
Exemplo n.º 2
0
def delete_task(jwt, task_id):
    error = False
    try:
        task = Task.query.get(task_id)
        if task is None:
            error = True
        else:
            DBHelper.delete(task)
    except:
        DBHelper.rollback()
        erro = True
    finally:
        DBHelper.close()
    if error:
        abort(404)
    return jsonify({"success": True})
Exemplo n.º 3
0
def delete_series(jwt, series_id):
    error = False
    try:
        series = Series.query.get(series_id)
        if series is None:
            error = True
        else:
            DBHelper.delete(series)
    except:
        DBHelper.rollback()
        error = True
    finally:
        DBHelper.close()
    if error:
        abort(404)
    return jsonify({"success": True})
Exemplo n.º 4
0
    def tearDown(self):

        challenges = Challenge.query.filter(Challenge.isTest == True)
        for challenge in challenges:
            DBHelper.delete(challenge)

        series = Series.query.filter(Series.isTest == True)
        for serie in series:
            DBHelper.delete(serie)

        series = Series.query.filter(Series.name.contains("test"))
        for serie in series:
            DBHelper.delete(serie)

        tasks = Task.query.filter(Task.isTest == True).filter(
            Series.name.contains("test"))
        for task in tasks:
            DBHelper.delete(task)

        asks = Task.query.filter(Task.name.contains("test"))
        for task in tasks:
            DBHelper.delete(task)