#NEWLINE# def test_ignore_response_cache_controls( self ) : #NEWLINE# #INDENT# sampledata = [ ( 200 , { #NEWLINE# #INDENT# 'Date' : self . yesterday , #NEWLINE# 'Expires' : self . tomorrow , #NEWLINE# #UNINDENT# } ) , ( 200 , { #NEWLINE# #INDENT# 'Date' : self . yesterday , #NEWLINE# 'Cache-Control' : 'no-store,max-age=86405' , #NEWLINE# #UNINDENT# } ) , ( 200 , { #NEWLINE# #INDENT# 'Age' : '299' , #NEWLINE# 'Cache-Control' : 'max-age=300,no-cache' , #NEWLINE# #UNINDENT# } ) , ( 300 , { #NEWLINE# #INDENT# 'Cache-Control' : 'no-cache' , #NEWLINE# #UNINDENT# } ) , ( 200 , { #NEWLINE# #INDENT# 'Expires' : self . tomorrow , #NEWLINE# 'Cache-Control' : 'no-store' , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# with self . _middleware ( HTTPCACHE_IGNORE_RESPONSE_CACHE_CONTROLS = [ 'no-cache' , 'no-store' ] ) as mw : #NEWLINE# #INDENT# for ( idx , ( status , headers ) ) in enumerate ( sampledata ) : #NEWLINE# #INDENT# req0 = Request ( ( 'http://example-%d.com' % idx ) ) #NEWLINE# res0 = Response ( req0 . url , status = status , headers = headers ) #NEWLINE# res1 = self . _process_requestresponse ( mw , req0 , res0 ) #NEWLINE# self . assertEqualResponse ( res1 , res0 ) #NEWLINE# assert ( 'cached' not in res1 . flags ) #NEWLINE# res2 = self . _process_requestresponse ( mw , req0 , None ) #NEWLINE# self . assertEqualResponse ( res1 , res2 ) #NEWLINE# assert ( 'cached' in res2 . flags )