<s> import random <EOL> from . . import base <EOL> from girder . models . token import genToken <EOL> def setUpModule ( ) : <EOL> base . startServer ( ) <EOL> def tearDownModule ( ) : <EOL> base . stopServer ( ) <EOL> class TokensTestCase ( base . TestCase ) : <EOL> def testCryptographicSecurity ( self ) : <EOL> random . seed ( <NUM_LIT:1> ) <EOL> token1 = genToken ( ) <EOL> random . seed ( <NUM_LIT:1> ) <EOL> token2 = genToken ( ) <EOL> self . assertNotEqual ( token1 , token2 ) <EOL> def testGetAndDeleteSession ( self ) : <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:GET>' ) <EOL> self . assertStatusOk ( resp ) <EOL> token = resp . json [ '<STR_LIT>' ] <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:GET>' ) <EOL> self . assertStatusOk ( resp ) <EOL> token2 = resp . json [ '<STR_LIT>' ] <EOL> self . assertNotEqual ( token , token2 ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:GET>' , token = token ) <EOL> self . assertStatusOk ( resp ) <EOL> token2 = resp . json [ '<STR_LIT>' ] <EOL> self . assertEqual ( token , token2 ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:GET>' ) <EOL> self . assertStatusOk ( resp ) <EOL> self . assertEqual ( resp . json , None ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:GET>' , token = token ) <EOL> self . assertStatusOk ( resp ) <EOL> self . assertEqual ( token , resp . json [ '<STR_LIT>' ] ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT>' ) <EOL> self . assertStatus ( resp , <NUM_LIT> ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT>' , token = token ) <EOL> self . assertStatusOk ( resp ) <EOL> resp = self . request ( path = '<STR_LIT>' , method = '<STR_LIT>' , token = token ) <EOL> self . assertStatus ( resp , <NUM_LIT> ) </s>
