Exemplo n.º 1
0
def test_2():
    cls_factories = {
        '': operation.factory,
        'cl': cl_request.factory,
        'wb': wb_request.factory,
    }
    func_factory = func.factory
    x = parse_json_conf('flows.json', cls_factories, func_factory, 'cl')

    flows = sort(x['Order'], x['Flows'])
    assert [f.name for f in flows] == ['IDP-Metadata-verify',
                                       'IDP-AuthnRedirect-verify',
                                       'IDP-AuthnRedirect-nid_email',
                                       'IDP-AuthnRedirect-nid_transient',
                                       'IDP-AuthnRedirect-nid_unspecified',
                                       'IDP-AuthnRedirect-no_nid',
                                       'IDP-AuthnPost-verify',
                                       'IDP-AuthnPost-nid_transient',
                                       'IDP-EntityCategory-coco',
                                       'IDP-EntityCategory-re_eu',
                                       'IDP-EntityCategory-re_hei',
                                       'IDP-EntityCategory-re_hei_sfs',
                                       'IDP-EntityCategory-re_nren',
                                       'IDP-EntityCategory-re_nren_sfs',
                                       'IDP-EntityCategory-rs',
                                       'IDP-Logout-soap']
Exemplo n.º 2
0
def test_sort():
    factories = {'': operation.factory}
    cnf = parse_json_conf('flows.json', factories, func.factory)

    flows = sort(cnf['Order'], cnf['Flows'])

    assert [f.name for f in flows] == ['AA-Dummy-Default-1', 'AA-Dummy-B',
                                       'AA-Dummy-A']
Exemplo n.º 3
0
def test_1():
    cls_factories = {
        '': operation.factory,
        'cl': cl_request.factory,
        'wb': wb_request.factory,
    }
    func_factory = func.factory
    x = parse_json_conf('flows.json', cls_factories, func_factory, 'cl')
    assert len(x['Flows']) == 16
Exemplo n.º 4
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
Exemplo n.º 5
0
def test_parse_json_conf():
    factories = {'': operation.factory}
    cnf = parse_json_conf('flows.json', factories, func.factory)

    assert cnf

    assert cnf['Desc'] == {'Default': 'Default settings'}
    assert _eq(list(cnf['Flows'].keys()),
               ['AA-Dummy-Default-1', 'AA-Dummy-A', 'AA-Dummy-B'])
    assert cnf['Order'] == ['AA-Dummy']
Exemplo n.º 6
0
def load_flows(fdef, flow_spec, use):
    logging.debug("loading text flows from " + flow_spec)
    cls_factories = {"wb": wb_factory, "": operation.factory}  # removed 'cl': cl_factory,

    if flow_spec.endswith(".yaml"):
        spec = parse_yaml_conf(flow_spec, cls_factories, factory, use=use)
    elif flow_spec.endswith(".json"):
        spec = parse_json_conf(flow_spec, cls_factories, factory, use=use)
    else:
        raise Exception("flow spec file type must be .yaml or .json, but %s found." % flow_spec)

    for param in ["Flows", "Desc"]:
        try:
            fdef[param].update(spec[param])
        except KeyError:
            pass

    fdef["Order"].extend(spec["Order"])

    return fdef