#NEWLINE# def test_set_get_flashes( self ) : #NEWLINE# #INDENT# class MyHandler ( BaseHandler ) : #NEWLINE# #INDENT# def get( self ) : #NEWLINE# #INDENT# res = [ msg for ( msg , level ) in self . session . get_flashes ( ) ] #NEWLINE# if ( not res ) : #NEWLINE# #INDENT# res = [ { #NEWLINE# #INDENT# 'body' : 'undefined' , #NEWLINE# #UNINDENT# } ] #NEWLINE# self . session . flash ( { #NEWLINE# #INDENT# 'body' : 'a flash value' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return Response ( res [ 0 ] [ 'body' ] ) #NEWLINE# #UNINDENT# #UNINDENT# rules = [ Rule ( '/' , name = 'test' , handler = MyHandler ) ] #NEWLINE# app = self . _get_app ( '/' ) #NEWLINE# app . router . add ( rules ) #NEWLINE# client = app . get_test_client ( ) #NEWLINE# response = client . get ( '/' ) #NEWLINE# self . assertEqual ( response . data , 'undefined' ) #NEWLINE# response = client . get ( '/' , headers = { #NEWLINE# #INDENT# 'Cookie' : '\n' . join ( response . headers . getlist ( 'Set-Cookie' ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . data , 'a flash value' )