Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/xml/tasks/test-remove-namespaced-attribute.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Setup test fixture
7 copy:
8 src: fixtures/ansible-xml-namespaced-beers.xml
9 dest: /tmp/ansible-xml-namespaced-beers.xml
10
11
12 - name: Remove namespaced '/bus:business/rat:rating/@attr:subjective'
13 xml:
14 path: /tmp/ansible-xml-namespaced-beers.xml
15 xpath: /bus:business/rat:rating/@attr:subjective
16 namespaces:
17 bus: http://test.business
18 ber: http://test.beers
19 rat: http://test.rating
20 attr: http://test.attribute
21 state: absent
22 register: remove_namespaced_attribute
23
24 - name: Add trailing newline
25 shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
26
27 - name: Compare to expected result
28 copy:
29 src: results/test-remove-namespaced-attribute.xml
30 dest: /tmp/ansible-xml-namespaced-beers.xml
31 check_mode: true
32 diff: true
33 register: comparison
34
35 - name: Test expected result
36 assert:
37 that:
38 - remove_namespaced_attribute is changed
39 - comparison is not changed # identical
40 # command: diff -u {{ role_path }}/results/test-remove-namespaced-attribute.xml /tmp/ansible-xml-namespaced-beers.xml