From 9857af2b6ec5490b3873be535f55f03ca9cae00b Mon Sep 17 00:00:00 2001
From: = <jhawkesworth@users.noreply.github.com>
Date: Thu, 16 Jun 2016 06:37:49 +0100
Subject: [PATCH] added further tests for win_regedit to cover the changes made
 under https://github.com/ansible/ansible-modules-extras/pull/2436

---
 .../roles/test_win_regedit/tasks/main.yml     | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/test/integration/roles/test_win_regedit/tasks/main.yml b/test/integration/roles/test_win_regedit/tasks/main.yml
index 361e6f9e81c..6948055dd1c 100644
--- a/test/integration/roles/test_win_regedit/tasks/main.yml
+++ b/test/integration/roles/test_win_regedit/tasks/main.yml
@@ -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'
@@ -372,6 +388,33 @@
 - assert:
     that:
       - "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
 
 - name: remove registry key used for testing