|
1 | 1 | --- |
2 | 2 | - name: Setup test fixture |
3 | | - copy: src=fixtures/ansible-xml-beers.xml dest=/tmp/ansible-xml-beers-implicit.xml |
| 3 | + copy: |
| 4 | + src: fixtures/ansible-xml-beers.xml |
| 5 | + dest: /tmp/ansible-xml-beers-implicit.xml |
4 | 6 |
|
5 | 7 | - name: Add a phonenumber element to the business element. Implicit mkdir -p behavior where applicable |
6 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/phonenumber value=555-555-1234 |
| 8 | + xml: |
| 9 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 10 | + xpath: /business/phonenumber |
| 11 | + value: 555-555-1234 |
7 | 12 |
|
8 | 13 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 1/2 |
9 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/owner/name/last value=Smith |
| 14 | + xml: |
| 15 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 16 | + xpath: /business/owner/name/last |
| 17 | + value: Smith |
10 | 18 |
|
11 | 19 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 2/2 |
12 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/owner/name/first value=John |
| 20 | + xml: |
| 21 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 22 | + xpath: /business/owner/name/first |
| 23 | + value: John |
13 | 24 |
|
14 | 25 | - name: Add a validxhtml element to the website element. Note that ensure is present by default and while value defaults to null for elements, if one doesn't specify it we don't know what to do. |
15 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/website/validxhtml |
| 26 | + xml: |
| 27 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 28 | + xpath: /business/website/validxhtml |
16 | 29 |
|
17 | 30 | - name: Add an empty validateon attribute to the validxhtml element. This actually makes the previous example redundant because of the implicit parent-node creation behavior. |
18 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/website/validxhtml/@validateon |
| 31 | + xml: |
| 32 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 33 | + xpath: /business/website/validxhtml/@validateon |
19 | 34 |
|
20 | 35 | - name: Add an empty validateon attribute to the validxhtml element. Actually verifies the implicit parent-node creation behavior. |
21 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/website_bis/validxhtml/@validateon |
| 36 | + xml: |
| 37 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 38 | + xpath: /business/website_bis/validxhtml/@validateon |
22 | 39 |
|
23 | 40 | - name: Add an attribute with a value |
24 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/owner/@dob='1976-04-12' |
| 41 | + xml: |
| 42 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 43 | + xpath: /business/owner/@dob='1976-04-12' |
25 | 44 |
|
26 | 45 | - name: Add an element with a value, alternate syntax |
27 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath="/business/beers/beer/text()=\"George Killian's Irish Red\"" # note the quote within an XPath string thing |
| 46 | + xml: |
| 47 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 48 | + # note the quote within an XPath string thing |
| 49 | + xpath: /business/beers/beer/text()="George Killian's Irish Red" |
28 | 50 |
|
29 | 51 | - name: Add an element without special characters |
30 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/testnormalelement value="xml tag with no special characters" pretty_print=true |
| 52 | + xml: |
| 53 | + file: /tmp/ansible-xml-beers-implicit.xml |
| 54 | + xpath: /business/testnormalelement |
| 55 | + value: xml tag with no special characters |
| 56 | + pretty_print: yes |
31 | 57 |
|
32 | 58 | - name: Add an element with dash |
33 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/test-with-dash value="xml tag with dashes" pretty_print=true |
| 59 | + xml: |
| 60 | + file: /tmp/ansible-xml-beers-implicit.xml |
| 61 | + xpath: /business/test-with-dash |
| 62 | + value: xml tag with dashes |
| 63 | + pretty_print: yes |
34 | 64 |
|
35 | 65 | - name: Add an element with dot |
36 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/test-with-dash.and.dot value="xml tag with dashes and dots" pretty_print=true |
| 66 | + xml: |
| 67 | + file: /tmp/ansible-xml-beers-implicit.xml |
| 68 | + xpath: /business/test-with-dash.and.dot |
| 69 | + value: xml tag with dashes and dots |
| 70 | + pretty_print: yes |
37 | 71 |
|
38 | 72 | - name: Add an element with underscore |
39 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/test-with.dash_and.dot_and-underscores value="xml tag with dashes, dots and underscores" pretty_print=true |
| 73 | + xml: |
| 74 | + file: /tmp/ansible-xml-beers-implicit.xml |
| 75 | + xpath: /business/test-with.dash_and.dot_and-underscores |
| 76 | + value: xml tag with dashes, dots and underscores |
| 77 | + pretty_print: yes |
40 | 78 |
|
41 | 79 | - name: Add an attribute on a conditional element |
42 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath="/business/beers/beer[text()=\"George Killian's Irish Red\"]/@color='red'" |
| 80 | + xml: |
| 81 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 82 | + xpath: /business/beers/beer[text()="George Killian's Irish Red"]/@color='red' |
43 | 83 |
|
44 | 84 | - name: Add two attributes on a conditional element |
45 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath="/business/beers/beer[text()=\"Pilsner Urquell\" and @origin='CZ']/@color='blonde'" |
| 85 | + xml: |
| 86 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 87 | + xpath: /business/beers/beer[text()="Pilsner Urquell" and @origin='CZ']/@color='blonde' |
46 | 88 |
|
47 | 89 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 3/2 -- complex lookup |
48 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml xpath=/business/owner/name[first/text()='John']/middle value=Q |
| 90 | + xml: |
| 91 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 92 | + xpath: /business/owner/name[first/text()='John']/middle |
| 93 | + value: Q |
49 | 94 |
|
50 | 95 | - name: Pretty Print this! |
51 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml pretty_print=True |
| 96 | + xml: |
| 97 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 98 | + pretty_print: yes |
52 | 99 |
|
53 | 100 | - name: Test expected result |
54 | 101 | command: diff -u results/test-add-element-implicitly.yml /tmp/ansible-xml-beers-implicit.xml |
|
59 | 106 |
|
60 | 107 | - name: Add a phonenumber element to the business element. Implicit mkdir -p behavior where applicable |
61 | 108 | xml: |
62 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 109 | + path: /tmp/ansible-xml-beers-implicit.xml |
63 | 110 | xpath: /business/a:phonenumber |
64 | 111 | value: 555-555-1234 |
65 | 112 | namespaces: |
66 | 113 | a: http://example.com/some/namespace |
67 | 114 |
|
68 | 115 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 1/2 |
69 | 116 | xml: |
70 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 117 | + path: /tmp/ansible-xml-beers-implicit.xml |
71 | 118 | xpath: /business/a:owner/a:name/a:last |
72 | 119 | value: Smith |
73 | 120 | namespaces: |
74 | 121 | a: http://example.com/some/namespace |
75 | 122 |
|
76 | 123 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 2/2 |
77 | 124 | xml: |
78 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 125 | + path: /tmp/ansible-xml-beers-implicit.xml |
79 | 126 | xpath: /business/a:owner/a:name/a:first |
80 | 127 | value: John |
81 | 128 | namespaces: |
82 | 129 | a: http://example.com/some/namespace |
83 | 130 |
|
84 | 131 | - name: Add a validxhtml element to the website element. Note that ensure is present by default and while value defaults to null for elements, if one doesn't specify it we don't know what to do. |
85 | 132 | xml: |
86 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 133 | + path: /tmp/ansible-xml-beers-implicit.xml |
87 | 134 | xpath: /business/a:website/a:validxhtml |
88 | 135 | namespaces: |
89 | 136 | a: http://example.com/some/namespace |
90 | 137 |
|
91 | 138 | - name: Add an empty validateon attribute to the validxhtml element. This actually makes the previous example redundant because of the implicit parent-node creation behavior. |
92 | 139 | xml: |
93 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 140 | + path: /tmp/ansible-xml-beers-implicit.xml |
94 | 141 | xpath: /business/a:website/a:validxhtml/@a:validateon |
95 | 142 | namespaces: |
96 | 143 | a: http://example.com/some/namespace |
97 | 144 |
|
98 | 145 | - name: Add an empty validateon attribute to the validxhtml element. Actually verifies the implicit parent-node creation behavior. |
99 | 146 | xml: |
100 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 147 | + path: /tmp/ansible-xml-beers-implicit.xml |
101 | 148 | xpath: /business/a:website_bis/a:validxhtml/@a:validateon |
102 | 149 | namespaces: |
103 | 150 | a: http://example.com/some/namespace |
104 | 151 |
|
105 | 152 | - name: Add an attribute with a value |
106 | 153 | xml: |
107 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 154 | + path: /tmp/ansible-xml-beers-implicit.xml |
108 | 155 | xpath: /business/a:owner/@a:dob='1976-04-12' |
109 | 156 | namespaces: |
110 | 157 | a: http://example.com/some/namespace |
111 | 158 |
|
112 | 159 | - name: Add an element with a value, alternate syntax |
113 | 160 | xml: |
114 | | - file: /tmp/ansible-xml-beers-implicit.xml |
115 | | - xpath: "/business/a:beers/a:beer/text()=\"George Killian's Irish Red\"" # note the quote within an XPath string thing |
| 161 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 162 | + xpath: /business/a:beers/a:beer/text()="George Killian's Irish Red" # note the quote within an XPath string thing |
116 | 163 | namespaces: |
117 | 164 | a: http://example.com/some/namespace |
118 | 165 |
|
119 | 166 | - name: Add an attribute on a conditional element |
120 | 167 | xml: |
121 | | - file: /tmp/ansible-xml-beers-implicit.xml |
122 | | - xpath: "/business/a:beers/a:beer[text()=\"George Killian's Irish Red\"]/@a:color='red'" |
| 168 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 169 | + xpath: /business/a:beers/a:beer[text()="George Killian's Irish Red"]/@a:color='red' |
123 | 170 | namespaces: |
124 | 171 | a: http://example.com/some/namespace |
125 | 172 |
|
126 | 173 | - name: Add two attributes on a conditional element |
127 | 174 | xml: |
128 | | - file: /tmp/ansible-xml-beers-implicit.xml |
129 | | - xpath: "/business/a:beers/a:beer[text()=\"Pilsner Urquell\" and @a:origin='CZ']/@a:color='blonde'" |
| 175 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 176 | + xpath: /business/a:beers/a:beer[text()="Pilsner Urquell" and @a:origin='CZ']/@a:color='blonde' |
130 | 177 | namespaces: |
131 | 178 | a: http://example.com/some/namespace |
132 | 179 |
|
133 | 180 | - name: Add a owner element to the business element, testing implicit mkdir -p behavior 3/2 -- complex lookup |
134 | 181 | xml: |
135 | | - file: /tmp/ansible-xml-beers-implicit.xml |
| 182 | + path: /tmp/ansible-xml-beers-implicit.xml |
136 | 183 | xpath: /business/a:owner/a:name[a:first/text()='John']/a:middle |
137 | 184 | value: Q |
138 | 185 | namespaces: |
|
176 | 223 | a: http://example.com/some/namespace |
177 | 224 |
|
178 | 225 | - name: Pretty Print this! |
179 | | - xml: file=/tmp/ansible-xml-beers-implicit.xml pretty_print=True |
| 226 | + xml: |
| 227 | + path: /tmp/ansible-xml-beers-implicit.xml |
| 228 | + pretty_print: yes |
0 commit comments