[DO NOT MERGE YET!] 2014.7 modules.file.replace test coverage

**HELP NEEDED: See below**

Based on the things reported in #18612, attempted to fix in #18615 and an additional case reported in #18841 I started to write some integration tests for `modules.file.replace()`.
All new tests except of `test_replace_issue_18841` work fine after applying the changes to `modules/file.py` also provided by this PR. I need some help with this specific one.
This test sets `search_only=True`:
```Python
ret = self.run_state('file.replace',
    name=path_test, pattern='^hello world$', repl='goodbye world', search_only=True)
```
This should result in no `*.bak` file being created.
Running the test shows, that there is a `*.bak` file created instead.
Running the command directly on CLI works just fine.
Inspecting `ret` shows, that the following warning is raised:
```
'search_only' is an invalid keyword argument for 'file.replace'.
If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs.
Your approach will work until Salt Lithium is out. Please update your state files."
```
Can anyone see why `search_only=True` isn't properly detected as keyword here?

Besides the tests which are provided with this PR, some more things should be tested regarding `replace()` such as:
  * are the `flags` honored in all cases?
  * can matching groups be used in `repl` in different scenarios?
  * is `count` respected in different scenarios?
  * handling of `bufsize`/`bufsize='file'`? Do multiline operations work properly?

Due to time limits someone else will have to take care of those things.
You might be onto something here. Will verify later. 
Thanks! 


On December 17, 2014 6:01:36 PM CET, Nicole Thomas <notifications@github.com> wrote:
>> +        path_test = os.path.join(integration.TMP, test_name)
>> +
>> +        # create test file based on initial template
>> +        shutil.copyfile(path_in, path_test)
>> +
>> +        # get (m|a)time of file
>> +        fstats_orig = os.stat(path_test)
>> +
>> +        # define how far we predate the file
>> +        age = 5*24*60*60
>> +
>> +        # set (m|a)time of file 5 days into the past
>> +        os.utime(path_test, (fstats_orig.st_mtime-age,
>fstats_orig.st_atime-age))
>> +
>> +        ret = self.run_state('file.replace',
>> +            name=path_test, pattern='^hello world$', repl='goodbye
>world', search_only=True)
>
>Hrm. I am not sure why that is happening, but glancing at your call to
>`file.replace` the `name` kwarg isn't one that normally gets passed
>into `file.replace`. It should be `path` I think. Maybe that's what is
>throwing something off.
>
>---
>Reply to this email directly or view it on GitHub:
>https://github.com/saltstack/salt/pull/19047/files#r21986380

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.