mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
Merge branch 'fix-5679' of https://github.com/jirutka/ansible into jirutka-fix-5679
This commit is contained in:
commit
9c9a940af6
2 changed files with 22 additions and 1 deletions
|
@ -524,6 +524,23 @@ class TestRunner(unittest.TestCase):
|
|||
result = self._run(*testcase)
|
||||
assert result['failed']
|
||||
|
||||
# insert multiline at the end of the file
|
||||
testline1 = '#12: The \\n character replaced with'
|
||||
testline2 = 'an actual newline.'
|
||||
testcase = ('lineinfile', [
|
||||
"dest=%s" % sample,
|
||||
"regexp='^#12: '",
|
||||
"line='%s\n%s'" % (testline1, testline2)
|
||||
])
|
||||
result = self._run(*testcase)
|
||||
assert result['changed']
|
||||
assert result['msg'] == 'line added'
|
||||
artifact = [x.strip() for x in open(sample)]
|
||||
assert artifact[-2] == testline1
|
||||
assert artifact[-1] == testline2
|
||||
assert artifact.count(testline1) == 1
|
||||
assert artifact.count(testline2) == 1
|
||||
|
||||
# cleanup
|
||||
os.unlink(sample)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue