#NEWLINE# def test_hash_file_success( self ) : #NEWLINE# #INDENT# '\n        Test if hash_file succeeds.\n        ' #NEWLINE# path = 'salt://saltines' #NEWLINE# mock_hash = { #NEWLINE# #INDENT# 'hsum' : 'deadbeef' , #NEWLINE# 'htype' : 'sha65536' , #NEWLINE# #UNINDENT# } #NEWLINE# ret = mock_hash #NEWLINE# class MockFileClient ( object ) : #NEWLINE# #INDENT# def hash_file( self , path , saltenv ) : #NEWLINE# #INDENT# return mock_hash #NEWLINE# #UNINDENT# #UNINDENT# mock_file_client = MockFileClient ( ) #NEWLINE# with patch . dict ( cp . __context__ , { #NEWLINE# #INDENT# 'cp.fileclient' : mock_file_client , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# with patch ( 'salt.modules.cp.hash_file' , MagicMock ( return_value = mock_hash ) ) : #NEWLINE# #INDENT# self . assertEqual ( cp . hash_file ( mock_hash ) , ret )