예제 #1
0
def test_1():
    import shutil
    from pykern import pkconfig, pkunit, pkio
    from pykern.pkunit import pkeq
    from pykern.pkdebug import pkdp
    from sirepo import srunit
    srunit.flask_client()

    from sirepo import cookie
    cookie.init_mock()
    cookie.init('x')
    with pkunit.pkexcept('Unauthorized'):
        cookie.get_user()
    with pkunit.pkexcept('Unauthorized'):
        cookie.get_user(checked=False)
    cookie.set_sentinel()
    cookie.set_user('abc')
    cookie.set_value('hi', 'hello')
    r = _Response(status_code=200)
    cookie.save_to_cookie(r)
    pkeq('sirepo_dev', r.args[0])
    pkeq(False, r.kwargs['secure'])
    pkeq('abc', cookie.get_user())
    cookie.clear_user()
    cookie.unchecked_remove('hi')
    pkeq(None, cookie.get_user(checked=False))
    cookie.init('sirepo_dev={}'.format(r.args[1]))
    pkeq('hello', cookie.get_value('hi'))
    pkeq('abc', cookie.get_user())
예제 #2
0
def _remove_cookie_key(name):
    value = cookie.get_value(name)
    cookie.unchecked_remove(name)
    return value
예제 #3
0
파일: oauth.py 프로젝트: e-carlin/sirepo
def _remove_cookie_key(name):
    value = cookie.get_value(name)
    cookie.unchecked_remove(name)
    return value
예제 #4
0
파일: __init__.py 프로젝트: mkeilman/sirepo
def reset_state():
    cookie.unchecked_remove(_COOKIE_USER)
    cookie.unchecked_remove(_COOKIE_METHOD)
    cookie.set_value(_COOKIE_STATE, _STATE_LOGGED_OUT)
    _set_log_user()