mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adding integration test based on #8535
This commit is contained in:
parent
83fa9a8cde
commit
66802169f5
1 changed files with 44 additions and 0 deletions
|
@ -294,3 +294,47 @@
|
||||||
that:
|
that:
|
||||||
- "result.stat.md5 == '65f955c2a9722fd43d07103d7756ff9b'"
|
- "result.stat.md5 == '65f955c2a9722fd43d07103d7756ff9b'"
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
# issue 8535
|
||||||
|
|
||||||
|
- name: create a new file for testing quoting issues
|
||||||
|
file: dest={{output_dir}}/test_quoting.txt state=touch
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: assert the new file was created
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed
|
||||||
|
|
||||||
|
- name: use with_items to add code-like strings to the quoting txt file
|
||||||
|
lineinfile: >
|
||||||
|
dest={{output_dir}}/test_quoting.txt
|
||||||
|
line="{{ item }}"
|
||||||
|
insertbefore=BOF
|
||||||
|
with_items:
|
||||||
|
- "'foo'"
|
||||||
|
- "dotenv.load();"
|
||||||
|
- "var dotenv = require('dotenv');"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: assert the quote test file was modified correctly
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.results|length == 3
|
||||||
|
- result.results[0].changed
|
||||||
|
- result.results[0].item == "'foo'"
|
||||||
|
- result.results[1].changed
|
||||||
|
- result.results[1].item == "dotenv.load();"
|
||||||
|
- result.results[2].changed
|
||||||
|
- result.results[2].item == "var dotenv = require('dotenv');"
|
||||||
|
|
||||||
|
- name: stat the quote test file
|
||||||
|
stat: path={{output_dir}}/test_quoting.txt
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: assert test md5 matches after backref line was replaced
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "result.stat.md5 == '29f349baf1b9c6703beeb346fe8dc669'"
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
|
Loading…
Reference in a new issue