Beispiel #1
0
def run_test(test_id):
    io = SamlClIO(**app_args)
    sh = SessionHandler(session={}, **app_args)
    sh.init_session({}, profile=app_args['profile'])
    tester = Tester(io, sh, **app_args)
    tester.setup(test_id, **app_args)

    flask.session["events"] = tester.conv.events
    flask.session["trace"] = tester.conv.trace

    print("TRACE", tester.conv.trace)
    return tester.run(test_id, **app_args)
Beispiel #2
0
def setup_tester():
    test_id, app_args = setup('wb')
    events = flask.session["events"]

    if not test_id:
        test_id = events.get('test_id')[0].data

    io = SamlClIO(**app_args)
    sh = SessionHandler(session={}, **app_args)
    sh.init_session({}, profile=app_args['profile'])
    tester = Tester(io, sh, **app_args)
    tester.setup(test_id, **app_args)
    tester.conv.events = flask.session["events"]
    tester.conv.trace = flask.session['trace']
    tester.conv.base_url = app_args["base_url"]
    tester.conv.test_id = test_id

    return tester, app_args
Beispiel #3
0
def test_session_init():
    factories = {'': operation.factory}
    cnf = parse_json_conf('flows.json', factories, func.factory)
    kwargs = {'profile': None, 'flows': cnf['Flows'], 'order': cnf['Order']}
    sh = SessionHandler(session={}, **kwargs)
    session = sh.init_session(sh.session, profile=kwargs['profile'])

    assert session['flow_names'] == ['AA-Dummy-Default-1', 'AA-Dummy-B',
                                     'AA-Dummy-A']
    assert len(session['tests']) == 3
Beispiel #4
0
def test_store_test_state():
    factories = {'': operation.factory}
    cnf = parse_yaml_conf('flows.yaml', factories, func.factory)
    kwargs = {'profile': None, 'flows': cnf['Flows'], 'order': cnf['Order']}
    sh = SessionHandler(session={}, **kwargs)
    session = sh.init_session(sh.session, profile=kwargs['profile'])
Beispiel #5
0
        res = Result(sh, kwargs['profile_handler'])
        if test_id not in kwargs['flows']:
            print(
                "The test id ({}) does not appear in the test definitions".format(
                    test_id))
            exit()

        webio = ClIO(**kwargs)
        tester = ClTester(webio, sh, **kwargs)
        if tester.run(test_id, **kwargs):
            res.print_info(sh, test_id)
    else:
        for tid in sh["flow_names"]:
            # New fresh session handler for every test
            _sh = SessionHandler({}, **kwargs)
            _sh.init_session(profile=kwargs['profile'])
            res = Result(_sh, kwargs['profile_handler'])

            webio = ClIO(**kwargs)
            tester = ClTester(webio, _sh, **kwargs)
            if tester.run(tid, **kwargs):
                if 'debug' in opargs and opargs['debug']:
                    res.print_info(tid)
                elif 'dump' in opargs and opargs['dump']:
                    res.print_info(tid)
                else:
                    res.result()
            else:
                res.print_info(tid)