Example #1
0
def session_setup(session, path, index=0):
    _keys = session.keys()
    for key in _keys:
        if key.startswith("_"):
            continue
        elif key in ["tests", "graph", "flow_names", "response_type",
                     "test_info", "profiles"]:  # don't touch !
            continue
        else:
            del session[key]

    ots = OIDCTestSetup(CONF, TEST_FLOWS, str(CONF.PORT))
    session["testid"] = path
    session["node"] = in_tree(session["graph"], path)
    sequence_info = ots.make_sequence(path)
    sequence_info = ots.add_init(sequence_info)
    session["seq_info"] = sequence_info
    trace = Trace()
    client_conf = ots.config.CLIENT
    conv = Conversation(ots.client, client_conf, trace, None,
                        message_factory, check_factory)
    conv.cache = CACHE
    session["ots"] = ots
    session["conv"] = conv
    session["index"] = index
    session["response_type"] = ""

    return conv, sequence_info, ots, trace, index
Example #2
0
def session_setup(session, path, index=0):
    _keys = session.keys()
    for key in _keys:
        if key.startswith("_"):
            continue
        elif key in [
                "tests", "graph", "flow_names", "response_type", "test_info",
                "profiles"
        ]:  # don't touch !
            continue
        else:
            del session[key]

    ots = OIDCTestSetup(CONF, TEST_FLOWS, str(CONF.PORT))
    session["testid"] = path
    session["node"] = in_tree(session["graph"], path)
    sequence_info = ots.make_sequence(path)
    sequence_info = ots.add_init(sequence_info)
    session["seq_info"] = sequence_info
    trace = Trace()
    client_conf = ots.config.CLIENT
    conv = Conversation(ots.client, client_conf, trace, None, message_factory,
                        check_factory)
    conv.cache = CACHE
    session["ots"] = ots
    session["conv"] = conv
    session["index"] = index
    session["response_type"] = ""

    return conv, sequence_info, ots, trace, index
Example #3
0
 def client_init(self):
     ots = OIDCTestSetup(CONF, TEST_FLOWS.FLOWS, str(CONF.PORT), UmaClient)
     client_conf = ots.config.CLIENT
     trace = Trace()
     conv = Conversation(ots.client, client_conf, trace, None,
                         uma_message_factory, check_factory)
     conv.cache = self.cache
     conv.check_factory = self.check_factory
     return ots, conv
Example #4
0
 def client_init(self):
     ots = OIDCTestSetup(self.conf, self.test_flows, str(self.conf.PORT))
     client_conf = ots.config.CLIENT
     trace = Trace()
     conv = Conversation(ots.client, client_conf, trace, None,
                         message_factory, self.check_factory)
     conv.cache = self.cache
     conv.check_factory = self.check_factory
     return ots, conv
Example #5
0
File: oprp.py Project: rohe/oictest
 def client_init(self):
     ots = OIDCTestSetup(self.conf, self.test_flows, str(self.conf.PORT))
     client_conf = ots.config.CLIENT
     trace = Trace()
     conv = Conversation(ots.client, client_conf, trace, None,
                         message_factory, self.check_factory)
     conv.cache = self.cache
     conv.check_factory = self.check_factory
     return ots, conv
Example #6
0
 def client_init(self):
     ots = OIDCTestSetup(CONF, TEST_FLOWS.FLOWS, str(CONF.PORT), UmaClient)
     client_conf = ots.config.CLIENT
     trace = Trace()
     conv = Conversation(ots.client, client_conf, trace, None,
                         uma_message_factory, check_factory)
     conv.cache = self.cache
     conv.check_factory = self.check_factory
     return ots, conv
Example #7
0
from rrtest import Trace
from oictest.oprp import not_supported
from oictest.base import Conversation
from oictest.check import factory as check_factory
from oictest.oidcrp import Client
from oic.oic.message import factory as message_factory

__author__ = 'roland'

_cli = Client()
CONV = Conversation(_cli, {}, Trace(), None,
                    message_factory, check_factory=check_factory)


def test_not_support():
    assert not_supported("abc", "abc") is None
    assert not_supported("bac", "abc") == ["bac"]
    assert not_supported("abc", ["abc", "def"]) is None
    assert not_supported("bac", ["abc", "def"]) == ["bac"]
    assert not_supported(["abc", "def"], ["abc", "def"]) is None
    assert not_supported(["bac", "def"], ["abc", "def"]) == ["bac"]
    assert not_supported(["abc", "def", "ghi"], ["abc", "def"]) == ["ghi"]

# TODO pi.google does not exist
# def test_support():
#     pi = json.loads(open("pi.google").read())
#     CONV.client.provider_info = ProviderConfigurationResponse(**pi)
#
#     stat = support(CONV, {'warning': {
#         'scopes_supported': ['profile', 'email', 'address', 'phone']}})
#
Example #8
0
    import importlib
    from oictest.base import Conversation
    from oictest.check import factory as check_factory
    from oictest.oidcrp import Client
    from oic.oic.message import factory as message_factory

    parser = argparse.ArgumentParser()
    parser.add_argument('-l', dest='log')
    parser.add_argument('-d', dest='dir')
    parser.add_argument('-c', dest="config")
    parser.add_argument('-D', dest="rec")
    args = parser.parse_args()

    if args.config:
        sys.path.insert(0, ".")
        CONF = importlib.import_module(args.config)
        conv = Conversation(Client, CONF.CLIENT, Trace(), None,
                            message_factory, check_factory=check_factory)

    if args.log:
        headers, trace, test, test_result = do_file(args.log)
        print headers["Timestamp"], test_result[0]

    if args.dir:
        print do_dir(args.dir)

    if args.rec:
        mat = {}
        res = do_dir(args.rec)
        print json.dumps(res)