<s> import unittest <EOL> from conans . server . crypto . jwt . jwt_credentials_manager import JWTCredentialsManager <EOL> from conans . server . crypto . jwt . jwt_manager import JWTManager <EOL> from datetime import timedelta <EOL> import time <EOL> import jwt <EOL> from jwt import DecodeError <EOL> class JwtTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> unittest . TestCase . setUp ( self ) <EOL> self . secret = "<STR_LIT>" <EOL> self . expire_time = timedelta ( seconds = <NUM_LIT:1> ) <EOL> def jwt_manager_test ( self ) : <EOL> manager = JWTManager ( self . secret , self . expire_time ) <EOL> profile = { "<STR_LIT:hello>" : "<STR_LIT>" } <EOL> token = manager . get_token_for ( profile ) <EOL> decrypted_profile = manager . get_profile ( token ) <EOL> self . assertEquals ( profile , decrypted_profile ) <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> self . assertRaises ( jwt . ExpiredSignature , manager . get_profile , token ) <EOL> def jwt_credentials_manager_test ( self ) : <EOL> manager = JWTCredentialsManager ( self . secret , self . expire_time ) <EOL> token = manager . get_token_for ( "<STR_LIT>" ) <EOL> self . assertEquals ( manager . get_user ( token ) , "<STR_LIT>" ) <EOL> self . assertRaises ( DecodeError , manager . get_user , "<STR_LIT>" ) </s>
