add collections
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
azp/posix/3
|
||||
destructive
|
||||
skip/aix
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Толстый бар</name>
|
||||
<beers>
|
||||
<beer>Окское</beer>
|
||||
<beer>Невское</beer>
|
||||
</beers>
|
||||
<rating subjective="да">десять</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tolstyybar.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating xmlns="http://test.rating" attr:subjective="true">10</rating>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer>Окское</beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer>Old Rasputin</beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer>Natty Lite</beer><beer>Miller Lite</beer><beer>Coors Lite</beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Old Rasputin</beer>
|
||||
<beer>Old Motor Oil</beer>
|
||||
<beer>Old Curmudgeon</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>Old Rasputin</beer>
|
||||
<beer>Old Motor Oil</beer>
|
||||
<beer>Old Curmudgeon</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer name="Окское" type="экстра"/></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer name="Ansible Brew" type="light"/></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer color="red">George Killian's Irish Red</beer>
|
||||
<beer origin="CZ" color="blonde">Pilsner Urquell</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
<validxhtml validateon=""/>
|
||||
</website>
|
||||
<phonenumber>555-555-1234</phonenumber>
|
||||
<owner dob="1976-04-12">
|
||||
<name>
|
||||
<last>Smith</last>
|
||||
<first>John</first>
|
||||
<middle>Q</middle>
|
||||
</name>
|
||||
</owner>
|
||||
<website_bis>
|
||||
<validxhtml validateon=""/>
|
||||
</website_bis>
|
||||
<testnormalelement>xml tag with no special characters</testnormalelement>
|
||||
<test-with-dash>xml tag with dashes</test-with-dash>
|
||||
<test-with-dash.and.dot>xml tag with dashes and dots</test-with-dash.and.dot>
|
||||
<test-with.dash_and.dot_and-underscores>xml tag with dashes, dots and underscores</test-with.dash_and.dot_and-underscores>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer>Old Rasputin</beer></beers>
|
||||
<rating xmlns="http://test.rating" attr:subjective="true">10</rating>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
<beer>Old Rasputin</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating>10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating xmlns="http://test.rating">10</rating>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="нет">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="false">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer alcohol="0.5" name="90 Minute IPA"><Water liter="0.2" quantity="200g"/><Starch quantity="10g"/><Hops quantity="50g"/><Yeast quantity="20g"/></beer><beer alcohol="0.3" name="Harvest Pumpkin Ale"><Water liter="0.2" quantity="200g"/><Hops quantity="25g"/><Yeast quantity="20g"/></beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Окское</beer><beer>Невское</beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>90 Minute IPA</beer><beer>Harvest Pumpkin Ale</beer></beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">10</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address></address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">пять</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
<rating>пять</rating></business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers>
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating subjective="true">5</rating>
|
||||
<website>
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
<rating>5</rating></business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating xmlns="http://test.rating" attr:subjective="false">10</rating>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<business xmlns="http://test.business" xmlns:attr="http://test.attribute" type="bar">
|
||||
<name>Tasty Beverage Co.</name>
|
||||
<beers xmlns="http://test.beers">
|
||||
<beer>Rochefort 10</beer>
|
||||
<beer>St. Bernardus Abbot 12</beer>
|
||||
<beer>Schlitz</beer>
|
||||
</beers>
|
||||
<rating xmlns="http://test.rating" attr:subjective="true">11</rating>
|
||||
<website xmlns="http://test.website">
|
||||
<mobilefriendly/>
|
||||
<address>http://tastybeverageco.com</address>
|
||||
</website>
|
||||
</business>
|
||||
@@ -0,0 +1,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)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Install lxml (FreeBSD)
|
||||
package:
|
||||
name: 'py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-lxml'
|
||||
state: present
|
||||
when: ansible_os_family == "FreeBSD"
|
||||
|
||||
# Needed for MacOSX !
|
||||
- name: Install lxml
|
||||
pip:
|
||||
name: lxml
|
||||
state: present
|
||||
# when: ansible_os_family == "Darwin"
|
||||
|
||||
- name: Get lxml version
|
||||
command: "{{ ansible_python_interpreter }} -c 'from lxml import etree; print(\".\".join(str(v) for v in etree.LXML_VERSION))'"
|
||||
register: lxml_version
|
||||
|
||||
- name: Set lxml capabilities as variables
|
||||
set_fact:
|
||||
# NOTE: Some tests require predictable element attribute order,
|
||||
# which is only guaranteed starting from lxml v3.0alpha1
|
||||
lxml_predictable_attribute_order: '{{ lxml_version.stdout is version("3", ">=") }}'
|
||||
|
||||
# NOTE: The xml module requires at least lxml v2.3.0
|
||||
lxml_xpath_attribute_result_attrname: '{{ lxml_version.stdout is version("2.3.0", ">=") }}'
|
||||
|
||||
- name: Only run the tests when lxml v2.3.0+
|
||||
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
|
||||
|
||||
# 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
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer: Окское
|
||||
register: add_children_elements_unicode
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: add_children_elements
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-children-from-groupvars.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertafter: yes
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
- beer: Old Motor Oil
|
||||
- beer: Old Curmudgeon
|
||||
pretty_print: yes
|
||||
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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_insertafter is changed
|
||||
- comparison is not changed # identical
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: '/business/beers/beer[text()="St. Bernardus Abbot 12"]'
|
||||
insertbefore: yes
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
- beer: Old Motor Oil
|
||||
- beer: Old Curmudgeon
|
||||
pretty_print: yes
|
||||
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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- add_children_insertbefore is changed
|
||||
- comparison is not changed # identical
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
- beer:
|
||||
name: Окское
|
||||
type: экстра
|
||||
register: add_children_with_attributes_unicode
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
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:
|
||||
- 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
|
||||
@@ -0,0 +1,241 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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-implicit.xml
|
||||
|
||||
|
||||
- name: Add a phonenumber element to the business element. Implicit mkdir -p behavior where applicable
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/phonenumber
|
||||
value: 555-555-1234
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 1/2
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/name/last
|
||||
value: Smith
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 2/2
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/name/first
|
||||
value: John
|
||||
|
||||
- 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.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/website/validxhtml
|
||||
|
||||
- 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.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/website/validxhtml/@validateon
|
||||
|
||||
- name: Add an empty validateon attribute to the validxhtml element. Actually verifies the implicit parent-node creation behavior.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/website_bis/validxhtml/@validateon
|
||||
|
||||
- name: Add an attribute with a value
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/@dob='1976-04-12'
|
||||
|
||||
- name: Add an element with a value, alternate syntax
|
||||
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
|
||||
|
||||
- name: Add an element without special characters
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/testnormalelement
|
||||
value: xml tag with no special characters
|
||||
pretty_print: yes
|
||||
|
||||
- name: Add an element with dash
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/test-with-dash
|
||||
value: xml tag with dashes
|
||||
pretty_print: yes
|
||||
|
||||
- name: Add an element with dot
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/test-with-dash.and.dot
|
||||
value: xml tag with dashes and dots
|
||||
pretty_print: yes
|
||||
|
||||
- name: Add an element with underscore
|
||||
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: yes
|
||||
|
||||
- name: Add an attribute on a conditional element
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/beers/beer[text()="George Killian's Irish Red"]/@color='red'
|
||||
|
||||
- name: Add two attributes on a conditional element
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/beers/beer[text()="Pilsner Urquell" and @origin='CZ']/@color='blonde'
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 3/2 -- complex lookup
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/owner/name[first/text()='John']/middle
|
||||
value: Q
|
||||
|
||||
- name: Pretty Print this!
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
pretty_print: yes
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-add-element-implicitly.xml
|
||||
dest: /tmp/ansible-xml-beers-implicit.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
# Now we repeat the same, just to ensure proper use of namespaces
|
||||
- name: Add a phonenumber element to the business element. Implicit mkdir -p behavior where applicable
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:phonenumber
|
||||
value: 555-555-1234
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 1/2
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:owner/a:name/a:last
|
||||
value: Smith
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 2/2
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:owner/a:name/a:first
|
||||
value: John
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- 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.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:website/a:validxhtml
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- 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.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:website/a:validxhtml/@a:validateon
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an empty validateon attribute to the validxhtml element. Actually verifies the implicit parent-node creation behavior.
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:website_bis/a:validxhtml/@a:validateon
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an attribute with a value
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:owner/@a:dob='1976-04-12'
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element with a value, alternate syntax
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:beers/a:beer/text()="George Killian's Irish Red" # note the quote within an XPath string thing
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an attribute on a conditional element
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:beers/a:beer[text()="George Killian's Irish Red"]/@a:color='red'
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add two attributes on a conditional element
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:beers/a:beer[text()="Pilsner Urquell" and @a:origin='CZ']/@a:color='blonde'
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add a owner element to the business element, testing implicit mkdir -p behavior 3/2 -- complex lookup
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/a:owner/a:name[a:first/text()='John']/a:middle
|
||||
value: Q
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element without special characters
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/testnormalelement
|
||||
value: xml tag with no special characters
|
||||
pretty_print: yes
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
|
||||
- name: Add an element with dash
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/test-with-dash
|
||||
value: xml tag with dashes
|
||||
pretty_print: yes
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element with dot
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
xpath: /business/test-with-dash.and.dot
|
||||
value: xml tag with dashes and dots
|
||||
pretty_print: yes
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Add an element with underscore
|
||||
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: yes
|
||||
namespaces:
|
||||
a: http://example.com/some/namespace
|
||||
|
||||
- name: Pretty Print this!
|
||||
xml:
|
||||
file: /tmp/ansible-xml-beers-implicit.xml
|
||||
pretty_print: yes
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Count child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers-unicode.xml
|
||||
xpath: /business/beers/beer
|
||||
count: yes
|
||||
register: beers
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- beers is not changed
|
||||
- beers.count == 2
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Add child element
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers/beer
|
||||
count: yes
|
||||
register: beers
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- beers is not changed
|
||||
- beers.count == 3
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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:
|
||||
- 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: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_text is not changed
|
||||
- get_element_text.matches[0]['rating'] == 'десять'
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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:
|
||||
- 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: 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: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- get_element_text is not changed
|
||||
- get_element_text.matches[0]['rating'] == '10'
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- module_output is not changed
|
||||
- module_output is failed
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Pretty print
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
pretty_print: yes
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: pretty_print
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-pretty-print.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-attribute.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-namespaced-attribute.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-remove-element.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-level.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed
|
||||
- comparison is not changed # identical
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: Set child elements
|
||||
xml:
|
||||
path: /tmp/ansible-xml-beers.xml
|
||||
xpath: /business/beers
|
||||
set_children: &children
|
||||
- beer: Окское
|
||||
- beer: Невское
|
||||
register: set_children_elements_unicode
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-children-elements.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
- 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-empty.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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 '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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value-unicode.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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'... 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-element-value.xml
|
||||
dest: /tmp/ansible-xml-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: Compare to expected result
|
||||
copy:
|
||||
src: results/test-set-namespaced-attribute-value.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers.xml
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: yes
|
||||
|
||||
- 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
|
||||
|
||||
- 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: yes
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
src: /tmp/ansible-xml-namespaced-beers-1.xml
|
||||
dest: /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
remote_src: yes
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
#command: diff /tmp/ansible-xml-namespaced-beers-1.xml /tmp/ansible-xml-namespaced-beers-2.xml
|
||||
|
||||
- name: Test expected result
|
||||
assert:
|
||||
that:
|
||||
- set_children_again is not changed # idempotency
|
||||
- set_namespaced_attribute_value is changed
|
||||
- comparison is not changed # identical
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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: 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: 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: yes
|
||||
diff: yes
|
||||
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:
|
||||
- set_element_first_run is changed
|
||||
- set_element_second_run is not changed
|
||||
- comparison is not changed # identical
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
# 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: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
# 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: yes
|
||||
register: xmlresponse
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print-only.xml'
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# 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: yes
|
||||
add_children:
|
||||
- beer: Old Rasputin
|
||||
register: xmlresponse_modification
|
||||
|
||||
- name: Compare to expected result
|
||||
copy:
|
||||
content: '{{ xmlresponse_modification.xmlstring }}'
|
||||
dest: '/tmp/test-pretty-print.xml'
|
||||
check_mode: yes
|
||||
diff: yes
|
||||
register: comparison
|
||||
|
||||
# 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
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
# -*- mode: yaml -*
|
||||
|
||||
bad_beers:
|
||||
- beer: "Natty Lite"
|
||||
- beer: "Miller Lite"
|
||||
- beer: "Coors Lite"
|
||||
Reference in New Issue
Block a user