summaryrefslogtreecommitdiff
path: root/test/integration/targets/argspec/tasks/main.yml
blob: 87d9a7b60263ec3e2d4053517049870e7527ed7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
- argspec:
    state: absent

- argspec:
    state: present
  register: argspec_required_if_fail
  ignore_errors: true

- argspec:
    state: present
    path: foo

- argspec:
    state: present
    content: foo

- argspec:
    state: present
    content: foo
    path: foo
  register: argspec_mutually_exclusive_fail
  ignore_errors: true

- argspec:
    mapping:
      foo: bar
  register: argspec_good_mapping

- argspec:
    mapping: foo=bar
  register: argspec_good_mapping_kv

- argspec:
    mapping: !!str '{"foo": "bar"}'
  register: argspec_good_mapping_json

- argspec:
    mapping: foo
  register: argspec_bad_mapping_string
  ignore_errors: true

- argspec:
    mapping: 1
  register: argspec_bad_mapping_int
  ignore_errors: true

- argspec:
    mapping:
      - foo
      - bar
  register: argspec_bad_mapping_list
  ignore_errors: true

- argspec:
    required_together:
      - thing: foo
        other: bar
        another: baz

- argspec:
    required_together:
      - another: baz

- argspec:
    required_together:
      - thing: foo
  register: argspec_required_together_fail
  ignore_errors: true

- argspec:
    required_together:
      - thing: foo
        other: bar

- argspec:
    required_if:
      - thing: bar

- argspec:
    required_if:
      - thing: foo
        other: bar

- argspec:
    required_if:
      - thing: foo
  register: argpsec_required_if_fail
  ignore_errors: true

- argspec:
    json: !!str '{"foo": "bar"}'
  register: argspec_good_json_string

- argspec:
    json:
      foo: bar
  register: argspec_good_json_dict

- argspec:
    json: 1
  register: argspec_bad_json
  ignore_errors: true

- argspec:
    fail_on_missing_params:
      - needed_param
    needed_param: whatever

- argspec:
    fail_on_missing_params:
      - needed_param
  register: argspec_fail_on_missing_params_bad
  ignore_errors: true

- argspec:
    required_together_one: foo
    required_together_two: bar

- argspec:
    required_together_one: foo
  register: argspec_fail_required_together
  ignore_errors: true

- argspec:
    suboptions_list_no_elements:
      - thing: foo
  register: argspec_suboptions_list_no_elements

- assert:
    that:
      - argspec_required_if_fail is failed

      - argspec_mutually_exclusive_fail is failed

      - argspec_good_mapping is successful
      - >-
        argspec_good_mapping.mapping == {'foo': 'bar'}
      - argspec_good_mapping_json is successful
      - >-
        argspec_good_mapping_json.mapping == {'foo': 'bar'}
      - argspec_good_mapping_kv is successful
      - >-
        argspec_good_mapping_kv.mapping == {'foo': 'bar'}
      - argspec_bad_mapping_string is failed
      - argspec_bad_mapping_int is failed
      - argspec_bad_mapping_list is failed

      - argspec_required_together_fail is failed

      - argpsec_required_if_fail is failed

      - argspec_good_json_string is successful
      - >-
        argspec_good_json_string.json == '{"foo": "bar"}'
      - argspec_good_json_dict is successful
      - >-
        argspec_good_json_dict.json == '{"foo": "bar"}'
      - argspec_bad_json is failed

      - argspec_fail_on_missing_params_bad is failed

      - argspec_fail_required_together is failed

      - >-
        argspec_suboptions_list_no_elements.suboptions_list_no_elements.0 == {'thing': 'foo'}