Merge pull request #25710 from jahamn/integration-test-for-issue-25250

Integration Testcase for Issue 25250
This commit is contained in:
Mike Place 2015-07-24 14:57:33 -06:00
commit fb4744b2f8

View file

@ -1727,6 +1727,23 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
finally:
os.remove(source)
def test_issue_25250_force_copy_deletes(self):
'''
ensure force option in copy state does not delete target file
'''
dest = os.path.join(integration.TMP, 'dest')
source = os.path.join(integration.TMP, 'source')
shutil.copyfile(os.path.join(integration.FILES, 'hosts'), source)
shutil.copyfile(os.path.join(integration.FILES, 'file/base/cheese'), dest)
self.run_state('file.copy', name=dest, source=source, force=True)
self.assertTrue(os.path.exists(dest))
self.assertTrue(filecmp.cmp(source, dest))
os.remove(source)
os.remove(dest)
if __name__ == '__main__':
from integration import run_tests
run_tests(FileTest)