This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
pyoidc-ozwillo/tests/test_stateless.py

31 lines
920 B
Python
Raw Normal View History

2013-12-17 14:13:56 +01:00
from oic.utils.stateless import StateLess
from utils_for_tests import _eq
2013-12-17 14:13:56 +01:00
__author__ = 'roland'
2013-12-17 14:13:56 +01:00
def test_access_code():
keys = {"OCT": ["symmetric key123"]}
st = StateLess(keys, enc_alg="A128KW", enc_method="A128CBC-HS256")
con = st.create_authz_session("subject",
{"redirect_uri": "https://example.com"})
2014-01-22 14:49:46 +01:00
tok = st.get_token(con)
2013-12-17 14:13:56 +01:00
_info = st[tok]
print _info
assert _eq(_info.keys(), ["typ", "aud", "val", "sub"])
assert _info["sub"] == "subject"
assert _info["typ"] == "code"
assert _info["aud"] == "https://example.com"
def test_update_to_access_token():
keys = {"OCT": ["symmetric key123"]}
st = StateLess(keys, enc_alg="A128KW", enc_method="A128CBC-HS256")
tok = st.create_authz_session("subject",
{"redirect_uri": "https://example.com"})
if __name__ == "__main__":
test_access_code()