Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/lookup_random_words/test.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - hosts: localhost
7 gather_facts: false
8 tasks:
9 - name: Call random_words plugin
10 set_fact:
11 result1: "{{ query('community.general.random_words') }}"
12 result2: "{{ query('community.general.random_words', min_length=5, max_length=5) }}"
13 result3: "{{ query('community.general.random_words', delimiter='!') }}"
14 result4: "{{ query('community.general.random_words', numwords=3, delimiter='-', case='capitalize') }}"
15 result5: "{{ query('community.general.random_words', min_length=5, max_length=5, numwords=3, delimiter='') }}"
16
17 - name: Check results
18 assert:
19 that:
20 - result1 | length == 1
21 - result1[0] | length >= 35
22 - result2 | length == 1
23 - result2[0] | length == 35
24 - result3 | length == 1
25 - result3[0].count("!") == 5
26 - result4 | length == 1
27 - result4[0] | length >= 17
28 - result4[0] | length <= 29
29 - result4[0] | regex_findall("[A-Z]") | length == 3
30 # If one of the random words is 't-shirt', there are more than 2 dashes...
31 - result4[0].count("-") == 2 or "t-shirt" in result4[0].lower()
32 - result5 | length == 1
33 - result5[0] | length == 15