<s> import os <EOL> from oic . utils . jwt import JWT <EOL> from oic . utils . keyio import build_keyjar <EOL> __author__ = '<STR_LIT>' <EOL> BASE_PATH = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) ) <EOL> keys = [ <EOL> { "<STR_LIT:type>" : "<STR_LIT>" , "<STR_LIT:key>" : os . path . join ( BASE_PATH , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] } , <EOL> { "<STR_LIT:type>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : [ "<STR_LIT>" ] } , <EOL> { "<STR_LIT:type>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : [ "<STR_LIT>" ] } <EOL> ] <EOL> jwks , keyjar , kidd = build_keyjar ( keys ) <EOL> issuer = '<STR_LIT>' <EOL> def _eq ( l1 , l2 ) : <EOL> return set ( l1 ) == set ( l2 ) <EOL> def test_jwt_pack ( ) : <EOL> _jwt = JWT ( keyjar , lifetime = <NUM_LIT> , iss = issuer ) . pack ( ) <EOL> assert _jwt <EOL> assert len ( _jwt . split ( '<STR_LIT:.>' ) ) == <NUM_LIT:3> <EOL> def test_jwt_pack_and_unpack ( ) : <EOL> srv = JWT ( keyjar , iss = issuer ) <EOL> _jwt = srv . pack ( sub = '<STR_LIT>' ) <EOL> info = srv . unpack ( _jwt ) <EOL> assert _eq ( info . keys ( ) , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) </s>
