#NEWLINE# def test_cache_file( self ) : #NEWLINE# #INDENT# '\n        Ensure file is cached to correct location\n        ' #NEWLINE# patched_opts = dict ( ( ( x , y ) for ( x , y ) in six . iteritems ( self . minion_opts ) ) ) #NEWLINE# patched_opts . update ( MOCKED_OPTS ) #NEWLINE# with patch . dict ( fileclient . __opts__ , patched_opts ) : #NEWLINE# #INDENT# client = fileclient . get_file_client ( fileclient . __opts__ , pillar = False ) #NEWLINE# for saltenv in SALTENVS : #NEWLINE# #INDENT# self . assertTrue ( client . cache_file ( 'salt://foo.txt' , saltenv , cachedir = None ) ) #NEWLINE# cache_loc = os . path . join ( fileclient . __opts__ [ 'cachedir' ] , 'files' , saltenv , 'foo.txt' ) #NEWLINE# with salt . utils . fopen ( cache_loc ) as fp_ : #NEWLINE# #INDENT# content = fp_ . read ( ) #NEWLINE# #UNINDENT# log . debug ( 'cache_loc = %s' , cache_loc ) #NEWLINE# log . debug ( 'content = %s' , content ) #NEWLINE# self . assertTrue ( ( saltenv in content ) )