

def test_manipulation_caught(client):
    client.get('/store-in-session/k1/value1/')
    rv = client.get('/dump-session/')
    s = json_dec(rv.data)
    assert (s['k1'] == 'value1')
    cookie = client.get_session_cookie()
    v_orig = cookie.value
    for i in range((len(v_orig) - 1)):
        broken_value = ((v_orig[:i] + ('a' if (v_orig[i] != 'a') else 'b')) + v_orig[(i + 1):])
        cookie.value = broken_value
        assert (broken_value != v_orig)
        rv = client.get('/dump-session/')
        s = json_dec(rv.data)
        assert (s == {
            
        }), ('manipulation check failed: %s / %s / %d' % (v_orig, s, i))
    cookie.value = v_orig
    rv = client.get('/dump-session/')
    s = json_dec(rv.data)
    assert (s['k1'] == 'value1')

dataset/ETHPy150Open mbr/flask-kvsession/tests/test_flask_kvsession.py test_manipulation_caught/VarMisuse@160/243 `broken_value`->`s`