Example #1
0
def application(environ, start_response):
    session = environ['beaker.session']

    path = environ.get('PATH_INFO', '').lstrip('/')
    if path == "robots.txt":
        return static(environ, start_response, LOGGER, "static/robots.txt")

    if path.startswith("static/"):
        return static(environ, start_response, LOGGER, path)

    if path.startswith("export/"):
        return static(environ, start_response, LOGGER, path)

    if path == "":  # list
        session_init(session, CONF, LOOKUP, testflows=rs_vs_as_tests)
        return flow_list(environ, start_response, session["tests"], session)
    elif "flow_names" not in session:
        session_init(session, CONF, LOOKUP, testflows=rs_vs_as_tests)

    if path == "continue":
        try:
            sequence_info = session["seq_info"]
        except KeyError:  # Cookie delete broke session
            query = parse_qs(environ["QUERY_STRING"])
            path = query["path"][0]
            index = query["index"][0]
            conv, sequence_info, ots, trace, index = session_setup(
                session, path, index)
        else:
            index = session["index"]
            ots = session["ots"]
            conv = session["conv"]

        index += 1
        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, conv.trace, index)
        except Exception, err:
            return test_error(environ, start_response, conv, err, session)
Example #2
0
def application(environ, start_response):
    session = environ['beaker.session']

    path = environ.get('PATH_INFO', '').lstrip('/')
    if path == "robots.txt":
        return static(environ, start_response, LOGGER, "static/robots.txt")

    if path.startswith("static/"):
        return static(environ, start_response, LOGGER, path)

    if path.startswith("export/"):
        return static(environ, start_response, LOGGER, path)

    if path == "":  # list
        session_init(session, CONF, LOOKUP, testflows=rs_vs_as_tests)
        return flow_list(environ, start_response, session["tests"], session)
    elif "flow_names" not in session:
        session_init(session, CONF, LOOKUP, testflows=rs_vs_as_tests)

    if path == "continue":
        try:
            sequence_info = session["seq_info"]
        except KeyError:  # Cookie delete broke session
            query = parse_qs(environ["QUERY_STRING"])
            path = query["path"][0]
            index = query["index"][0]
            conv, sequence_info, ots, trace, index = session_setup(session,
                                                                   path, index)
        else:
            index = session["index"]
            ots = session["ots"]
            conv = session["conv"]

        index += 1
        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, conv.trace, index)
        except Exception, err:
            return test_error(environ, start_response, conv, err, session)
Example #3
0
            conv, sequence_info, ots, trace, index = session_setup(
                session, path, index)
        else:
            index = session["index"]
            ots = session["ots"]
            conv = session["conv"]

        index += 1
        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, conv.trace, index)
        except Exception, err:
            return test_error(environ, start_response, conv, err, session)
    # expected path format: /<testid>[/<endpoint>]
    elif path in session["flow_names"]:
        conv, sequence_info, ots, trace, index = session_setup(session, path)
        try:
            conv.test_sequence(sequence_info["tests"]["pre"])
        except KeyError:
            pass

        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, trace, index)
        except Exception, err:
            session["node"].state = 3
            exception_trace("run_sequence", err, trace)
            return test_error(environ, start_response, conv, err)
    else:
        if path != "authz_post":
            if not session["response_type"] == ["code"]:
Example #4
0
            conv, sequence_info, ots, trace, index = session_setup(session,
                                                                   path, index)
        else:
            index = session["index"]
            ots = session["ots"]
            conv = session["conv"]

        index += 1
        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, conv.trace, index)
        except Exception, err:
            return test_error(environ, start_response, conv, err, session)
    # expected path format: /<testid>[/<endpoint>]
    elif path in session["flow_names"]:
        conv, sequence_info, ots, trace, index = session_setup(session, path)
        try:
            conv.test_sequence(sequence_info["tests"]["pre"])
        except KeyError:
            pass

        try:
            return run_sequence(sequence_info, session, conv, ots, environ,
                                start_response, trace, index)
        except Exception, err:
            session["node"].state = 3
            exception_trace("run_sequence", err, trace)
            return test_error(environ, start_response, conv, err)
    else:
        if path != "authz_post":
            if not session["response_type"] == ["code"]: