2021-07-11 16:34:59 +02:00
|
|
|
# (c) 2021, Alexei Znamensky
|
2022-08-05 12:28:29 +02:00
|
|
|
# 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
|
2021-07-11 16:34:59 +02:00
|
|
|
|
2021-12-05 21:47:51 +01:00
|
|
|
- name: test msimple (set a=80)
|
2021-04-05 15:19:13 +02:00
|
|
|
msimple:
|
|
|
|
a: 80
|
|
|
|
register: simple1
|
|
|
|
|
|
|
|
- name: assert simple1
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- simple1.a == 80
|
|
|
|
- simple1.abc == "abc"
|
2021-07-16 19:29:00 +02:00
|
|
|
- simple1 is not changed
|
2021-04-05 15:19:13 +02:00
|
|
|
- simple1.value is none
|
|
|
|
|
|
|
|
- name: test msimple 2
|
|
|
|
msimple:
|
|
|
|
a: 101
|
|
|
|
ignore_errors: yes
|
|
|
|
register: simple2
|
|
|
|
|
|
|
|
- name: assert simple2
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- simple2.a == 101
|
|
|
|
- 'simple2.msg == "Module failed with exception: a >= 100"'
|
|
|
|
- simple2.abc == "abc"
|
2021-07-16 19:29:00 +02:00
|
|
|
- simple2 is failed
|
|
|
|
- simple2 is not changed
|
2021-04-05 15:19:13 +02:00
|
|
|
- simple2.value is none
|
|
|
|
|
|
|
|
- name: test msimple 3
|
|
|
|
msimple:
|
|
|
|
a: 2
|
|
|
|
b: potatoes
|
|
|
|
register: simple3
|
|
|
|
|
|
|
|
- name: assert simple3
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- simple3.a == 2
|
|
|
|
- simple3.b == "potatoespotatoes"
|
|
|
|
- simple3.c == "NoneNone"
|
2021-07-16 19:29:00 +02:00
|
|
|
- simple3 is not changed
|
2021-04-05 15:19:13 +02:00
|
|
|
|
|
|
|
- name: test msimple 4
|
|
|
|
msimple:
|
|
|
|
c: abc change
|
|
|
|
register: simple4
|
|
|
|
|
|
|
|
- name: assert simple4
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- simple4.c == "abc change"
|
|
|
|
- simple4.abc == "changed abc"
|
2021-07-16 19:29:00 +02:00
|
|
|
- simple4 is changed
|
2021-12-05 21:47:51 +01:00
|
|
|
|
|
|
|
- name: test msimple 5a
|
|
|
|
msimple:
|
|
|
|
a: 3 # should triple b and c
|
|
|
|
b: oh
|
|
|
|
c: my
|
|
|
|
register: simple5a
|
|
|
|
|
|
|
|
- name: test msimple 5b
|
|
|
|
check_mode: true
|
|
|
|
msimple:
|
|
|
|
a: 3 # should triple b and c
|
|
|
|
b: oh
|
|
|
|
c: my
|
|
|
|
register: simple5b
|
|
|
|
|
|
|
|
- name: assert simple5
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- simple5a.a == 3
|
|
|
|
- simple5a.b == "ohohoh"
|
|
|
|
- simple5a.c == "mymymy"
|
|
|
|
- simple5a is not changed
|
|
|
|
- simple5b.a == 3
|
|
|
|
- simple5b.b == "oh"
|
|
|
|
- simple5b.c == "my"
|
|
|
|
- simple5b is not changed
|