mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added further tests for win_regedit to cover the changes made
under https://github.com/ansible/ansible-modules-extras/pull/2436
This commit is contained in:
parent
0a0b44baeb
commit
9857af2b6e
1 changed files with 43 additions and 0 deletions
|
@ -18,6 +18,22 @@
|
||||||
|
|
||||||
# clear the area of the registry we are using for tests
|
# clear the area of the registry we are using for tests
|
||||||
|
|
||||||
|
# test mangled registry key gets caught following https://github.com/ansible/ansible-modules-extras/issues/2412
|
||||||
|
|
||||||
|
- name: test mangled registry key is caught (avoids bizare error message from powershell)
|
||||||
|
win_regedit:
|
||||||
|
key: HKCU\Software
|
||||||
|
value: invalid_key
|
||||||
|
data: invalid_key
|
||||||
|
datatype: string
|
||||||
|
register: check00_result
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "check00_result.failed == true"
|
||||||
|
- "check00_result.msg == 'key: HKCU\\Software is not a valid powershell path, see module documentation for examples.'"
|
||||||
|
|
||||||
- name: remove setting
|
- name: remove setting
|
||||||
win_regedit:
|
win_regedit:
|
||||||
key: 'HKCU:\SOFTWARE\Cow Corp'
|
key: 'HKCU:\SOFTWARE\Cow Corp'
|
||||||
|
@ -372,6 +388,33 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "check62_result.changed == false"
|
- "check62_result.changed == false"
|
||||||
|
|
||||||
|
# test dword
|
||||||
|
|
||||||
|
- name: check basic set dword works
|
||||||
|
win_regedit:
|
||||||
|
key: HKCU:\Software\Cow Corp
|
||||||
|
value: hello_dword
|
||||||
|
data: 00000000
|
||||||
|
datatype: dword
|
||||||
|
register: check71_result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "check71_result.changed == true"
|
||||||
|
|
||||||
|
- name: check that setting the same dword again is not changed
|
||||||
|
win_regedit:
|
||||||
|
key: HKCU:\Software\Cow Corp
|
||||||
|
value: hello_dword
|
||||||
|
data: 00000000
|
||||||
|
datatype: dword
|
||||||
|
register: check72_result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "check72_result.changed == false"
|
||||||
|
|
||||||
# tear down
|
# tear down
|
||||||
|
|
||||||
- name: remove registry key used for testing
|
- name: remove registry key used for testing
|
||||||
|
|
Loading…
Reference in a new issue