mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-12 09:04:21 -07:00
Adjust YAML files (#10233)
Adjust YAML files.
(cherry picked from commit eaa5e07b28
)
This commit is contained in:
parent
e8ff74f077
commit
a9e892952d
244 changed files with 7272 additions and 7329 deletions
|
@ -47,40 +47,40 @@
|
|||
when: lxml_xpath_attribute_result_attrname
|
||||
block:
|
||||
|
||||
- include_tasks: test-add-children-elements.yml
|
||||
- include_tasks: test-add-children-from-groupvars.yml
|
||||
- include_tasks: test-add-children-insertafter.yml
|
||||
- include_tasks: test-add-children-insertbefore.yml
|
||||
- include_tasks: test-add-children-with-attributes.yml
|
||||
- include_tasks: test-add-element-implicitly.yml
|
||||
- include_tasks: test-count.yml
|
||||
- include_tasks: test-mutually-exclusive-attributes.yml
|
||||
- include_tasks: test-remove-attribute.yml
|
||||
- include_tasks: test-remove-attribute-nochange.yml
|
||||
- include_tasks: test-remove-element.yml
|
||||
- include_tasks: test-remove-element-nochange.yml
|
||||
- include_tasks: test-set-attribute-value.yml
|
||||
- include_tasks: test-set-children-elements.yml
|
||||
- include_tasks: test-set-children-elements-level.yml
|
||||
- include_tasks: test-set-element-value.yml
|
||||
- include_tasks: test-set-element-value-empty.yml
|
||||
- include_tasks: test-pretty-print.yml
|
||||
- include_tasks: test-pretty-print-only.yml
|
||||
- include_tasks: test-add-namespaced-children-elements.yml
|
||||
- include_tasks: test-remove-namespaced-attribute.yml
|
||||
- include_tasks: test-remove-namespaced-attribute-nochange.yml
|
||||
- include_tasks: test-set-namespaced-attribute-value.yml
|
||||
- include_tasks: test-set-namespaced-element-value.yml
|
||||
- include_tasks: test-set-namespaced-children-elements.yml
|
||||
- include_tasks: test-get-element-content.yml
|
||||
- include_tasks: test-xmlstring.yml
|
||||
- include_tasks: test-children-elements-xml.yml
|
||||
- include_tasks: test-add-children-elements.yml
|
||||
- include_tasks: test-add-children-from-groupvars.yml
|
||||
- include_tasks: test-add-children-insertafter.yml
|
||||
- include_tasks: test-add-children-insertbefore.yml
|
||||
- include_tasks: test-add-children-with-attributes.yml
|
||||
- include_tasks: test-add-element-implicitly.yml
|
||||
- include_tasks: test-count.yml
|
||||
- include_tasks: test-mutually-exclusive-attributes.yml
|
||||
- include_tasks: test-remove-attribute.yml
|
||||
- include_tasks: test-remove-attribute-nochange.yml
|
||||
- include_tasks: test-remove-element.yml
|
||||
- include_tasks: test-remove-element-nochange.yml
|
||||
- include_tasks: test-set-attribute-value.yml
|
||||
- include_tasks: test-set-children-elements.yml
|
||||
- include_tasks: test-set-children-elements-level.yml
|
||||
- include_tasks: test-set-element-value.yml
|
||||
- include_tasks: test-set-element-value-empty.yml
|
||||
- include_tasks: test-pretty-print.yml
|
||||
- include_tasks: test-pretty-print-only.yml
|
||||
- include_tasks: test-add-namespaced-children-elements.yml
|
||||
- include_tasks: test-remove-namespaced-attribute.yml
|
||||
- include_tasks: test-remove-namespaced-attribute-nochange.yml
|
||||
- include_tasks: test-set-namespaced-attribute-value.yml
|
||||
- include_tasks: test-set-namespaced-element-value.yml
|
||||
- include_tasks: test-set-namespaced-children-elements.yml
|
||||
- include_tasks: test-get-element-content.yml
|
||||
- include_tasks: test-xmlstring.yml
|
||||
- include_tasks: test-children-elements-xml.yml
|
||||
|
||||
# Unicode tests
|
||||
- include_tasks: test-add-children-elements-unicode.yml
|
||||
- include_tasks: test-add-children-with-attributes-unicode.yml
|
||||
- include_tasks: test-set-attribute-value-unicode.yml
|
||||
- include_tasks: test-count-unicode.yml
|
||||
- include_tasks: test-get-element-content.yml
|
||||
- include_tasks: test-set-children-elements-unicode.yml
|
||||
- include_tasks: test-set-element-value-unicode.yml
|
||||
# Unicode tests
|
||||
- include_tasks: test-add-children-elements-unicode.yml
|
||||
- include_tasks: test-add-children-with-attributes-unicode.yml
|
||||
- include_tasks: test-set-attribute-value-unicode.yml
|
||||
- include_tasks: test-count-unicode.yml
|
||||
- include_tasks: test-get-element-content.yml
|
||||
- include_tasks: test-set-children-elements-unicode.yml
|
||||
- include_tasks: test-set-element-value-unicode.yml
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer: Окское
|
||||
register: add_children_elements_unicode
|
||||
register: add_children_elements_unicode
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_elements_unicode is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: add_children_elements
|
||||
register: add_children_elements
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_elements is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children: '{{ bad_beers }}'
|
||||
register: add_children_from_groupvars
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children: '{{ bad_beers }}'
|
||||
register: add_children_from_groupvars
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-from-groupvars.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-from-groupvars.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_from_groupvars is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-from-groupvars.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-from-groupvars.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertafter: true
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertafter: true
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
- beer: Old Motor Oil
|
||||
- beer: Old Curmudgeon
|
||||
pretty_print: true
|
||||
register: add_children_insertafter
|
||||
pretty_print: true
|
||||
register: add_children_insertafter
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-insertafter.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-insertafter.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_insertafter is changed
|
||||
- comparison is not changed # identical
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertbefore: true
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertbefore: true
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
- beer: Old Motor Oil
|
||||
- beer: Old Curmudgeon
|
||||
pretty_print: true
|
||||
register: add_children_insertbefore
|
||||
pretty_print: true
|
||||
register: add_children_insertbefore
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-insertbefore.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-insertbefore.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_insertbefore is changed
|
||||
- comparison is not changed # identical
|
||||
|
|
|
@ -3,36 +3,36 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer:
|
||||
name: Окское
|
||||
type: экстра
|
||||
register: add_children_with_attributes_unicode
|
||||
register: add_children_with_attributes_unicode
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-with-attributes-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-with-attributes-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_with_attributes_unicode is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-with-attributes-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-with-attributes-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,40 +3,40 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer:
|
||||
name: Ansible Brew
|
||||
type: light
|
||||
register: add_children_with_attributes
|
||||
register: add_children_with_attributes
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-with-attributes.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-with-attributes.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
# NOTE: This test may fail if lxml does not support predictable element attribute order
|
||||
# So we filter the failure out for these platforms (e.g. CentOS 6)
|
||||
# The module still works fine, we simply are not comparing as smart as we should.
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
# NOTE: This test may fail if lxml does not support predictable element attribute order
|
||||
# So we filter the failure out for these platforms (e.g. CentOS 6)
|
||||
# The module still works fine, we simply are not comparing as smart as we should.
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_with_attributes is changed
|
||||
- comparison is not changed # identical
|
||||
when: lxml_predictable_attribute_order
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-with-attributes.xml /tmp/ansible-xml-beers.xml
|
||||
when: lxml_predictable_attribute_order
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-with-attributes.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
- name: Add an attribute with a value
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/@dob='1976-04-12'
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/@dob='1976-04-12'
|
||||
|
||||
- name: Add an element with a value, alternate syntax
|
||||
xml:
|
||||
|
@ -112,8 +112,8 @@
|
|||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-element-implicitly.xml /tmp/ansible-xml-beers-implicit.xml
|
||||
- comparison is not changed # identical
|
||||
# command: diff -u {{ role_path }}/results/test-add-element-implicitly.xml /tmp/ansible-xml-beers-implicit.xml
|
||||
|
||||
|
||||
# Now we repeat the same, just to ensure proper use of namespaces
|
||||
|
@ -205,7 +205,7 @@
|
|||
value: xml tag with no special characters
|
||||
pretty_print: true
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
|
||||
- name: Add an element with dash
|
||||
|
@ -215,7 +215,7 @@
|
|||
value: xml tag with dashes
|
||||
pretty_print: true
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element with dot
|
||||
xml:
|
||||
|
@ -224,7 +224,7 @@
|
|||
value: xml tag with dashes and dots
|
||||
pretty_print: true
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element with underscore
|
||||
xml:
|
||||
|
@ -233,7 +233,7 @@
|
|||
value: xml tag with dashes, dots and underscores
|
||||
pretty_print: true
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Pretty Print this!
|
||||
xml:
|
||||
|
|
|
@ -3,37 +3,37 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Add namespaced child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
add_children:
|
||||
- name: Add namespaced child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: add_namespaced_children_elements
|
||||
register: add_namespaced_children_elements
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-namespaced-children-elements.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-namespaced-children-elements.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_namespaced_children_elements is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-namespaced-children-elements.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-namespaced-children-elements.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element with xml format
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
input_type: xml
|
||||
add_children:
|
||||
- name: Add child element with xml format
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
input_type: xml
|
||||
add_children:
|
||||
- '<beer>Old Rasputin</beer>'
|
||||
register: children_elements
|
||||
register: children_elements
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- children_elements is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-add-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-add-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers-unicode.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers-unicode.xml
|
||||
|
||||
|
||||
- name: Count child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/beers/beer
|
||||
count: true
|
||||
register: beers
|
||||
- name: Count child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/beers/beer
|
||||
count: true
|
||||
register: beers
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- beers is not changed
|
||||
- beers.count == 2
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers/beer
|
||||
count: true
|
||||
register: beers
|
||||
- name: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers/beer
|
||||
count: true
|
||||
register: beers
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- beers is not changed
|
||||
- beers.count == 3
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers-unicode.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers-unicode.xml
|
||||
|
||||
|
||||
- name: Get element attributes
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
register: get_element_attribute
|
||||
- name: Get element attributes
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
register: get_element_attribute
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_attribute is not changed
|
||||
- get_element_attribute.matches[0]['rating'] is defined and get_element_attribute.matches[0]['rating']['subjective'] == 'да'
|
||||
|
||||
- name: Get element text
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/rating
|
||||
content: text
|
||||
register: get_element_text
|
||||
- name: Get element text
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/rating
|
||||
content: text
|
||||
register: get_element_text
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_text is not changed
|
||||
- get_element_text.matches[0]['rating'] == 'десять'
|
||||
|
|
|
@ -3,49 +3,49 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Get element attributes
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
register: get_element_attribute
|
||||
- name: Get element attributes
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
register: get_element_attribute
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_attribute is not changed
|
||||
- get_element_attribute.matches[0]['rating'] is defined
|
||||
- get_element_attribute.matches[0]['rating']['subjective'] == 'true'
|
||||
|
||||
- name: Get element attributes (should fail)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
attribute: subjective
|
||||
register: get_element_attribute_wrong
|
||||
ignore_errors: true
|
||||
- name: Get element attributes (should fail)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: attribute
|
||||
attribute: subjective
|
||||
register: get_element_attribute_wrong
|
||||
ignore_errors: true
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_attribute_wrong is failed
|
||||
|
||||
- name: Get element text
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: text
|
||||
register: get_element_text
|
||||
- name: Get element text
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
content: text
|
||||
register: get_element_text
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_text is not changed
|
||||
- get_element_text.matches[0]['rating'] == '10'
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Specify both children to add and a value
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
add_children:
|
||||
- child01
|
||||
- child02
|
||||
value: conflict!
|
||||
register: module_output
|
||||
ignore_errors: true
|
||||
- name: Specify both children to add and a value
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
add_children:
|
||||
- child01
|
||||
- child02
|
||||
value: conflict!
|
||||
register: module_output
|
||||
ignore_errors: true
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- module_output is not changed
|
||||
- module_output is failed
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml.orig
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml.orig
|
||||
|
||||
- name: Remove spaces from test fixture
|
||||
shell: sed 's/^[ ]*//g' < /tmp/ansible-xml-beers.xml.orig > /tmp/ansible-xml-beers.xml
|
||||
- name: Remove spaces from test fixture
|
||||
shell: sed 's/^[ ]*//g' < /tmp/ansible-xml-beers.xml.orig > /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Pretty print without modification
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
pretty_print: true
|
||||
register: pretty_print_only
|
||||
- name: Pretty print without modification
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
pretty_print: true
|
||||
register: pretty_print_only
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-pretty-print-only.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-pretty-print-only.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- pretty_print_only is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Pretty print
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
pretty_print: true
|
||||
add_children:
|
||||
- name: Pretty print
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
pretty_print: true
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: pretty_print
|
||||
register: pretty_print
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-pretty-print.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-pretty-print.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- pretty_print is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-pretty-print.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-pretty-print.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,30 +3,30 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Remove non-existing '/business/rating/@subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating/@subjective
|
||||
state: absent
|
||||
register: remove_attribute
|
||||
- name: Remove non-existing '/business/rating/@subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating/@subjective
|
||||
state: absent
|
||||
register: remove_attribute
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_attribute is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-attribute.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-attribute.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Remove '/business/rating/@subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating/@subjective
|
||||
state: absent
|
||||
register: remove_attribute
|
||||
- name: Remove '/business/rating/@subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating/@subjective
|
||||
state: absent
|
||||
register: remove_attribute
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_attribute is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-attribute.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-attribute.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,30 +3,30 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Remove non-existing '/business/rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
state: absent
|
||||
register: remove_element
|
||||
- name: Remove non-existing '/business/rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
state: absent
|
||||
register: remove_element
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_element is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Remove '/business/rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
state: absent
|
||||
register: remove_element
|
||||
- name: Remove '/business/rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
state: absent
|
||||
register: remove_element
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_element is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Remove non-existing namespaced '/bus:business/rat:rating/@attr:subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating/@attr:subjective
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_attribute
|
||||
- name: Remove non-existing namespaced '/bus:business/rat:rating/@attr:subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating/@attr:subjective
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_attribute
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_namespaced_attribute is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-namespaced-attribute.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-namespaced-attribute.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,38 +3,38 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Remove namespaced '/bus:business/rat:rating/@attr:subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating/@attr:subjective
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_attribute
|
||||
- name: Remove namespaced '/bus:business/rat:rating/@attr:subjective'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating/@attr:subjective
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_attribute
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_namespaced_attribute is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-namespaced-attribute.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-namespaced-attribute.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Remove non-existing namespaced '/bus:business/rat:rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_element
|
||||
- name: Remove non-existing namespaced '/bus:business/rat:rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_element
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_namespaced_element is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,38 +3,38 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Remove namespaced '/bus:business/rat:rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_element
|
||||
- name: Remove namespaced '/bus:business/rat:rating'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
state: absent
|
||||
register: remove_namespaced_element
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- remove_namespaced_element is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-remove-element.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set '/business/rating/@subjective' to 'нет'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
attribute: subjective
|
||||
value: нет
|
||||
register: set_attribute_value_unicode
|
||||
- name: Set '/business/rating/@subjective' to 'нет'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
attribute: subjective
|
||||
value: нет
|
||||
register: set_attribute_value_unicode
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_attribute_value_unicode is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-attribute-value-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-attribute-value-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,34 +3,34 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set '/business/rating/@subjective' to 'false'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
attribute: subjective
|
||||
value: 'false'
|
||||
register: set_attribute_value
|
||||
- name: Set '/business/rating/@subjective' to 'false'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
attribute: subjective
|
||||
value: 'false'
|
||||
register: set_attribute_value
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_attribute_value is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-attribute-value.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-attribute-value.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,79 +3,79 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer:
|
||||
alcohol: "0.5"
|
||||
name: 90 Minute IPA
|
||||
_:
|
||||
- Water:
|
||||
liter: "0.2"
|
||||
quantity: 200g
|
||||
- Starch:
|
||||
quantity: 10g
|
||||
- Hops:
|
||||
quantity: 50g
|
||||
- Yeast:
|
||||
quantity: 20g
|
||||
- beer:
|
||||
alcohol: "0.3"
|
||||
name: Harvest Pumpkin Ale
|
||||
_:
|
||||
- Water:
|
||||
liter: "0.2"
|
||||
quantity: 200g
|
||||
- Hops:
|
||||
quantity: 25g
|
||||
- Yeast:
|
||||
quantity: 20g
|
||||
register: set_children_elements_level
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer:
|
||||
alcohol: "0.5"
|
||||
name: 90 Minute IPA
|
||||
_:
|
||||
- Water:
|
||||
liter: "0.2"
|
||||
quantity: 200g
|
||||
- Starch:
|
||||
quantity: 10g
|
||||
- Hops:
|
||||
quantity: 50g
|
||||
- Yeast:
|
||||
quantity: 20g
|
||||
- beer:
|
||||
alcohol: "0.3"
|
||||
name: Harvest Pumpkin Ale
|
||||
_:
|
||||
- Water:
|
||||
liter: "0.2"
|
||||
quantity: 200g
|
||||
- Hops:
|
||||
quantity: 25g
|
||||
- Yeast:
|
||||
quantity: 20g
|
||||
register: set_children_elements_level
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-level.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-level.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_elements_level is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements-level.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements-level.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set child elements (again)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: *children
|
||||
register: set_children_again
|
||||
- name: Set child elements (again)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: *children
|
||||
register: set_children_again
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-level.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-level.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed
|
||||
- comparison is not changed # identical
|
||||
|
|
|
@ -3,51 +3,51 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer: Окское
|
||||
- beer: Невское
|
||||
register: set_children_elements_unicode
|
||||
register: set_children_elements_unicode
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_elements_unicode is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,84 +3,84 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Set child elements - empty list
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: []
|
||||
register: set_children_elements
|
||||
- name: Set child elements - empty list
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: []
|
||||
register: set_children_elements
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-empty-list.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-empty-list.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_elements is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer: 90 Minute IPA
|
||||
- beer: Harvest Pumpkin Ale
|
||||
register: set_children_elements
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer: 90 Minute IPA
|
||||
- beer: Harvest Pumpkin Ale
|
||||
register: set_children_elements
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_elements is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set child elements (again)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: *children
|
||||
register: set_children_again
|
||||
- name: Set child elements (again)
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: *children
|
||||
register: set_children_again
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-children-elements.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Set '/business/website/address' to empty string.
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/website/address
|
||||
value: ''
|
||||
register: set_element_value_empty
|
||||
- name: Set '/business/website/address' to empty string.
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/website/address
|
||||
value: ''
|
||||
register: set_element_value_empty
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-empty.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-empty.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_element_value_empty is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-element-value-empty.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-element-value-empty.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,48 +3,48 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add 2nd '/business/rating' with value 'пять'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business
|
||||
add_children:
|
||||
- name: Add 2nd '/business/rating' with value 'пять'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business
|
||||
add_children:
|
||||
- rating: пять
|
||||
|
||||
- name: Set '/business/rating' to 'пять'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: пять
|
||||
register: set_element_first_run
|
||||
- name: Set '/business/rating' to 'пять'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: пять
|
||||
register: set_element_first_run
|
||||
|
||||
- name: Set '/business/rating' to 'false'... again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: пять
|
||||
register: set_element_second_run
|
||||
- name: Set '/business/rating' to 'false'... again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: пять
|
||||
register: set_element_second_run
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_element_first_run is changed
|
||||
- set_element_second_run is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-element-value-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-element-value-unicode.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,48 +3,48 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-beers.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
- name: Add 2nd '/business/rating' with value '5'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business
|
||||
add_children:
|
||||
- name: Add 2nd '/business/rating' with value '5'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business
|
||||
add_children:
|
||||
- rating: '5'
|
||||
|
||||
- name: Set '/business/rating' to '5'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: '5'
|
||||
register: set_element_first_run
|
||||
- name: Set '/business/rating' to '5'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: '5'
|
||||
register: set_element_first_run
|
||||
|
||||
- name: Set '/business/rating' to '5'... again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: '5'
|
||||
register: set_element_second_run
|
||||
- name: Set '/business/rating' to '5'... again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/rating
|
||||
value: '5'
|
||||
register: set_element_second_run
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_element_first_run is changed
|
||||
- set_element_second_run is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-element-value.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-element-value.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Set namespaced '/bus:business/rat:rating/@attr:subjective' to 'false'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
attribute: attr:subjective
|
||||
value: 'false'
|
||||
register: set_namespaced_attribute_value
|
||||
- name: Set namespaced '/bus:business/rat:rating/@attr:subjective' to 'false'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
xpath: /bus:business/rat:rating
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
attribute: attr:subjective
|
||||
value: 'false'
|
||||
register: set_namespaced_attribute_value
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-namespaced-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-namespaced-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_namespaced_attribute_value is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-set-namespaced-attribute-value.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-set-namespaced-attribute-value.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
|
|
@ -3,59 +3,59 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
set_children:
|
||||
- name: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
set_children:
|
||||
- beer: 90 Minute IPA
|
||||
- beer: Harvest Pumpkin Ale
|
||||
|
||||
- name: Copy state after first set_children
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-1.xml
|
||||
remote_src: true
|
||||
- name: Copy state after first set_children
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-1.xml
|
||||
remote_src: true
|
||||
|
||||
- name: Set child elements again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
set_children:
|
||||
- name: Set child elements again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers-xml.xml
|
||||
xpath: /bus:business/ber:beers
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
set_children:
|
||||
- beer: 90 Minute IPA
|
||||
- beer: Harvest Pumpkin Ale
|
||||
register: set_children_again
|
||||
register: set_children_again
|
||||
|
||||
- name: Copy state after second set_children
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
remote_src: true
|
||||
- name: Copy state after second set_children
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
remote_src: true
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers-1.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
remote_src: true
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
#command: diff /tmp/ansible-xml-namespaced-beers-1.xml /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers-1.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
remote_src: true
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
# command: diff /tmp/ansible-xml-namespaced-beers-1.xml /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed # idempotency
|
||||
- set_namespaced_attribute_value is changed
|
||||
- comparison is not changed # identical
|
||||
|
|
|
@ -3,51 +3,51 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Setup test fixture
|
||||
copy:
|
||||
src: fixtures/ansible-xml-namespaced-beers.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
|
||||
- name: Set namespaced '/bus:business/rat:rating' to '11'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
xpath: /bus:business/rat:rating
|
||||
value: '11'
|
||||
register: set_element_first_run
|
||||
- name: Set namespaced '/bus:business/rat:rating' to '11'
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
xpath: /bus:business/rat:rating
|
||||
value: '11'
|
||||
register: set_element_first_run
|
||||
|
||||
- name: Set namespaced '/bus:business/rat:rating' to '11' again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
xpath: /bus:business/rat:rating
|
||||
value: '11'
|
||||
register: set_element_second_run
|
||||
- name: Set namespaced '/bus:business/rat:rating' to '11' again
|
||||
xml:
|
||||
path: /tmp/ansible-xml-namespaced-beers.xml
|
||||
namespaces:
|
||||
bus: http://test.business
|
||||
ber: http://test.beers
|
||||
rat: http://test.rating
|
||||
attr: http://test.attribute
|
||||
xpath: /bus:business/rat:rating
|
||||
value: '11'
|
||||
register: set_element_second_run
|
||||
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Add trailing newline
|
||||
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-namespaced-element-value.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
#command: diff -u {{ role_path }}/results/test-set-namespaced-element-value.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-namespaced-element-value.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
# command: diff -u {{ role_path }}/results/test-set-namespaced-element-value.xml /tmp/ansible-xml-namespaced-beers.xml
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_element_first_run is changed
|
||||
- set_element_second_run is not changed
|
||||
- comparison is not changed # identical
|
||||
|
|
|
@ -3,83 +3,83 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Copy expected results to remote
|
||||
copy:
|
||||
src: "results/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- test-pretty-print.xml
|
||||
- test-pretty-print-only.xml
|
||||
- name: Copy expected results to remote
|
||||
copy:
|
||||
src: "results/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- test-pretty-print.xml
|
||||
- test-pretty-print-only.xml
|
||||
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring (not using pretty_print)
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
xpath: .
|
||||
register: xmlresponse
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring (not using pretty_print)
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
xpath: .
|
||||
register: xmlresponse
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: "{{ xmlresponse.xmlstring }}\n"
|
||||
dest: '/tmp/test-pretty-print-only.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: "{{ xmlresponse.xmlstring }}\n"
|
||||
dest: '/tmp/test-pretty-print-only.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- xmlresponse is not changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring (using pretty_print)
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
pretty_print: true
|
||||
register: xmlresponse
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring (using pretty_print)
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
pretty_print: true
|
||||
register: xmlresponse
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print-only.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print-only.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
# FIXME: This change is related to the newline added by pretty_print
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
# FIXME: This change is related to the newline added by pretty_print
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- xmlresponse is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-pretty-print-only.xml /tmp/ansible-xml-beers.xml
|
||||
|
||||
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
xpath: /business/beers
|
||||
pretty_print: true
|
||||
add_children:
|
||||
# NOTE: Jinja2 templating eats trailing newlines
|
||||
- name: Read from xmlstring
|
||||
xml:
|
||||
xmlstring: "{{ lookup('file', '{{ role_path }}/fixtures/ansible-xml-beers.xml') }}"
|
||||
xpath: /business/beers
|
||||
pretty_print: true
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: xmlresponse_modification
|
||||
register: xmlresponse_modification
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse_modification.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse_modification.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print.xml'
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: comparison
|
||||
|
||||
# FIXME: This change is related to the newline added by pretty_print
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
# FIXME: This change is related to the newline added by pretty_print
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- xmlresponse_modification is changed
|
||||
- comparison is not changed # identical
|
||||
#command: diff -u {{ role_path }}/results/test-pretty-print.xml /tmp/ansible-xml-beers.xml
|
||||
# command: diff -u {{ role_path }}/results/test-pretty-print.xml /tmp/ansible-xml-beers.xml
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
# -*- mode: yaml -*
|
||||
|
||||
bad_beers:
|
||||
- beer: "Natty Lite"
|
||||
- beer: "Miller Lite"
|
||||
- beer: "Coors Lite"
|
||||
- beer: "Natty Lite"
|
||||
- beer: "Miller Lite"
|
||||
- beer: "Coors Lite"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue