Exemple #1
0
def session_budget():
    """
    Set or get the budget for this team.
    """
    if request.method != "POST":
        return create_response(get_session_budget(get_session_id()))

    data = json.loads(request.data.decode("utf-8"))
    budget = data["budget"]
    set_session_budget(budget, get_session_id())
    return create_response("OK")
Exemple #2
0
def test_set__get_budget():
    with test_session_scope() as ts:
        assert reset_session_squad(session_id=API_SESSION_ID, dbsession=ts)
        assert set_session_budget(500, API_SESSION_ID, ts)
        assert get_session_budget(API_SESSION_ID, ts) == 500