#NEWLINE# def forward( app ) : #NEWLINE# #INDENT# app = TestApp ( RecursiveMiddleware ( app ) ) #NEWLINE# res = app . get ( '' ) #NEWLINE# assert ( res . header ( 'content-type' ) == 'text/plain' ) #NEWLINE# assert ( res . full_status == '200 OK' ) #NEWLINE# assert ( 'requested page returned' in res ) #NEWLINE# res = app . get ( '/error' ) #NEWLINE# assert ( res . header ( 'content-type' ) == 'text/plain' ) #NEWLINE# assert ( res . full_status == '200 OK' ) #NEWLINE# assert ( 'Page not found' in res ) #NEWLINE# res = app . get ( '/not_found' ) #NEWLINE# assert ( res . header ( 'content-type' ) == 'text/plain' ) #NEWLINE# assert ( res . full_status == '200 OK' ) #NEWLINE# assert ( 'Page not found' in res ) #NEWLINE# try : #NEWLINE# #INDENT# res = app . get ( '/recurse' ) #NEWLINE# #UNINDENT# except AssertionError as e : #NEWLINE# #INDENT# if str ( e ) . startswith ( 'Forwarding loop detected' ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise AssertionError ( 'Failed to detect forwarding loop' )