

def test_login_or_logout(self, client, service, user_data):
    from cookielib import Cookie
    args = [None, None, '', None, None, '/', None, None, 86400, None, None, None, None]
    gaema_user_key = (GAEMA_USER_KEY_FORMAT % service)
    if (hasattr(settings, 'GAEMA_STORAGE') and (settings.GAEMA_STORAGE == 'cookie')):
        client.cookie_jar.set_cookie(Cookie(1, gaema_user_key, user_data, *args))
    else:
        session_store = import_string(settings.SESSION_STORE)()
        data = None
        for cookie in client.cookie_jar:
            if (cookie.name == settings.COOKIE_NAME):
                data = cookie.value
        if (data is None):
            session = session_store.new()
        else:
            session = session_store.get(data)
        session[gaema_user_key] = user_data
        session_store.save(session)
        data = ('"%s"' % session_store.get_data(session))
        client.cookie_jar.set_cookie(Cookie(1, settings.COOKIE_NAME, data, *args))

dataset/ETHPy150Open IanLewis/kay/kay/auth/backends/gaema.py GAEMABackend.test_login_or_logout/original