#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# auth = self . auth = CookieAuth ( get_user_identity , identify_user ) #NEWLINE# def anonymouse( env , data ) : #NEWLINE# #INDENT# self . assert_ ( hasattr ( env , 'user' ) ) #NEWLINE# self . assertEqual ( env . user , None ) #NEWLINE# return web . Response ( 'ok' ) #NEWLINE# #UNINDENT# def no_anonymouse( env , data ) : #NEWLINE# #INDENT# self . assert_ ( hasattr ( env , 'user' ) ) #NEWLINE# self . assertEqual ( env . user , MockUser ( name = 'user name' ) ) #NEWLINE# return web . Response ( 'ok' ) #NEWLINE# #UNINDENT# self . app = web . cases ( auth . login ( ) , auth . logout ( ) , ( auth | web . cases ( ( web . match ( '/a' , 'a' ) | anonymouse ) , ( ( web . match ( '/b' , 'b' ) | auth_required ) | no_anonymouse ) ) ) )