def step_impl(context): """ :type context behave.runner.Context """ if hasattr(context, "session_id"): try: check_session(context.session_id) except AuthenticationError: ok_(True) else: ok_(True)
def step_impl(context): """ :type context behave.runner.Context """ ok_(check_session(context.session_id) is not None)
def _check_session_aspect(func, *args, **kwargs): """CherryPy-specific check_session aspect code, checks if there is a valid cookie""" try: # Try and find _session_id _session_id = cherrypy.request.cookie["session_id"].value except: raise AuthenticationError("Authentication aspect for \"" + func.__name__ + "\": No session_id cookie") # Set user variable and execute function. kwargs["_user"] = check_session(_session_id) kwargs["_session_id"] = _session_id return func(*args, **kwargs)