Пример #1
0
def test_cookie_parts():
    name = 'pyoidc'
    kaka = ('pyoidc=bjmc::1463043535::upm|'
            '1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499')
    result = cookie_parts(name, kaka)
    assert result == ['bjmc::1463043535::upm',
                      '1463043535',
                      '18a201305fa15a96ce4048e1fbb03f7715f86499']
Пример #2
0
def test_cookie_parts():
    name = 'pyoidc'
    kaka = ('pyoidc=bjmc::1463043535::upm|'
            '1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499')
    result = cookie_parts(name, kaka)
    assert result == ['bjmc::1463043535::upm',
                      '1463043535',
                      '18a201305fa15a96ce4048e1fbb03f7715f86499']
Пример #3
0
def test_cookie_parts():
    name = "pyoidc"
    kaka = ("pyoidc=bjmc::1463043535::upm|"
            "1463043535|18a201305fa15a96ce4048e1fbb03f7715f86499")
    result = cookie_parts(name, kaka)
    assert result == [
        "bjmc::1463043535::upm",
        "1463043535",
        "18a201305fa15a96ce4048e1fbb03f7715f86499",
    ]
Пример #4
0
def factory(kaka, sdb, config):
    """
    Return the right Consumer instance dependent on what's in the cookie

    :param kaka: The cookie
    :param sdb: The session database
    :param config: The common Consumer configuration
    :return: Consumer instance or None
    """
    part = http_util.cookie_parts(config["name"], kaka)
    if part is None:
        return None

    cons = Consumer(sdb, config=config)
    cons.restore(part[0])
    http_util.parse_cookie(config["name"], cons.seed, kaka)
    return cons
Пример #5
0
def factory(kaka, sdb, config):
    """
    Return the right Consumer instance dependent on what's in the cookie

    :param kaka: The cookie
    :param sdb: The session database
    :param config: The common Consumer configuration
    :return: Consumer instance or None
    """
    part = http_util.cookie_parts(config["name"], kaka)
    if part is None:
        return None

    cons = Consumer(sdb, config=config)
    cons.restore(part[0])
    http_util.parse_cookie(config["name"], cons.seed, kaka)
    return cons
Пример #6
0
def factory(kaka, sdb, client_id, **kwargs):
    """
    Return the right Consumer instance dependent on what's in the cookie.

    :param kaka: The cookie
    :param sdb: The session database
    :param kwargs: The Consumer configuration arguments
    :return: Consumer instance or None
    """
    part = http_util.cookie_parts(client_id, kaka)
    if part is None:
        return None

    cons = Consumer(sdb, **kwargs)
    cons.restore(part[0])
    http_util.parse_cookie(client_id, cons.seed, kaka)
    return cons
Пример #7
0
def factory(kaka, sdb, client_id, **kwargs):
    """
    Return the right Consumer instance dependent on what's in the cookie

    :param kaka: The cookie
    :param sdb: The session database
    :param kwargs: The Consumer configuration arguments
    :return: Consumer instance or None
    """
    part = http_util.cookie_parts(client_id, kaka)
    if part is None:
        return None

    cons = Consumer(sdb, **kwargs)
    cons.restore(part[0])
    http_util.parse_cookie(client_id, cons.seed, kaka)
    return cons