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:
= 2016-06-16 06:37:49 +01:00 committed by nitzmahone
parent 8223b83758
commit 5d03a65ee8

View file

@ -18,6 +18,22 @@
# 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
win_regedit:
key: 'HKCU:\SOFTWARE\Cow Corp'
@ -349,6 +365,33 @@
that:
- "check56_result.changed == true"
# 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
- name: remove registry key used for testing