Exemplo n.º 1
0
#    print "GSess: %s" % _cli.grant
    kaka = http_util.cookie(CONSUMER_CONFIG["name"], _cli.state, _cli.seed,
                            expire=360, path="/")

    resp = http_util.Response("Your will is registered", headers=[kaka])
    return resp(environ, start_response)

capp = TestApp(handle_authz_response)
cres = capp.get(url)
assert cres.status == "200 OK"
#print cres.headers
assert "Set-Cookie" in cres.headers.keys()

# get the userinfo

# construct what the client sends to the server
_oac = Consumer(SESSION_DB, CONSUMER_CONFIG, CLIENT_CONFIG, SERVER_INFO)

for key, val in _oac.sdb.items():
    if key.startswith("seed:"):
        _oac.restore(val)

path, method, h_args = _oac.user_info_request()

# Let the server deal with the request
res = app.get(path, extra_environ={"oic.server":SERVER, "mako.lookup":LOOKUP})

print res
assert res.status == "200 OK"
assert res.body == '{"verified": true, "name": "Curtis Granderson", "email": "*****@*****.**"}'