#NEWLINE# @ patch ( 'os.path.isdir' , return_value = False ) #NEWLINE# @ patch ( 'salt.utils.which' , return_value = '/bin/patch' ) #NEWLINE# def test_patch_dry_run( self , mock_which , mock_isdir ) : #NEWLINE# #INDENT# cmd_mock = MagicMock ( return_value = 'test_retval' ) #NEWLINE# with patch . dict ( filemod . __salt__ , { #NEWLINE# #INDENT# 'cmd.run_all' : cmd_mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# ret = filemod . patch ( '/path/to/file' , '/path/to/patch' , dry_run = True ) #NEWLINE# #UNINDENT# cmd = [ '/bin/patch' , '--dry-run' , '--forward' , '--reject-file=-' , '-i' , '/path/to/patch' , '/path/to/file' ] #NEWLINE# cmd_mock . assert_called_once_with ( cmd , python_shell = False ) #NEWLINE# self . assertEqual ( 'test_retval' , cmd )