summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2017-03-23 23:15:28 +0100
committerMatt Davis <nitzmahone@users.noreply.github.com>2017-03-23 23:15:28 +0100
commitf1ab879bb62cbec56230b7db04a8a08cf3086d12 (patch)
tree5315548047d1a1fa34893c606cc92267a735cd0f /test
parentwin_share: tweaks after the caching mode changes (#22763) (diff)
downloadansible-f1ab879bb62cbec56230b7db04a8a08cf3086d12.tar.xz
ansible-f1ab879bb62cbec56230b7db04a8a08cf3086d12.zip
win_reg_stat change the module parameters for standardisation (#22732)
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/win_reg_stat/tasks/main.yml186
1 files changed, 89 insertions, 97 deletions
diff --git a/test/integration/targets/win_reg_stat/tasks/main.yml b/test/integration/targets/win_reg_stat/tasks/main.yml
index 82679edbbf..a212b2b2dd 100644
--- a/test/integration/targets/win_reg_stat/tasks/main.yml
+++ b/test/integration/targets/win_reg_stat/tasks/main.yml
@@ -1,4 +1,9 @@
---
+- name: test
+ win_file:
+ path: "{{win_output_dir}}"
+ state: absent
+
- name: make sure win output dir exists
win_file:
path: "{{win_output_dir}}"
@@ -20,44 +25,43 @@
win_command: powershell.exe $env:windir
register: win_dir_value
-- name: expect failure when not passing in key option
+- name: expect failure when not passing in path option
win_reg_stat:
- property: a
+ name: a
register: actual
- failed_when: "actual.msg != 'Missing required argument: key'"
+ failed_when: "actual.msg != 'Missing required argument: path'"
- name: expect failure when passing in an invalid hive
win_reg_stat:
- key: ABCD:\test
+ path: ABCD:\test
register: actual
- failed_when: actual.msg != "the hive in key is 'ABCD'; must be 'HKCR', 'HKCC', 'HKCU', 'HKLM' or 'HKU'"
+ failed_when: actual.msg != "the hive in path is 'ABCD'; must be 'HKCR', 'HKCC', 'HKCU', 'HKLM' or 'HKU'"
- name: get known nested reg key structure for testing with short hive form
win_reg_stat:
- key: HKCU:\Test\nested
+ path: HKCU:\Test\nested
register: actual_short
- name: get known nested reg key structure for testing with quoted yaml
win_reg_stat:
- key: "HKCU:\\Test\\nested"
+ path: "HKCU:\\Test\\nested"
register: actual_quoted
- name: set expected value for reg structure
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- properties:
- binary: { raw_value: ["0x01", "0x16"], type: 'REG_BINARY', value: [1, 22] }
- dword: { raw_value: 1, type: 'REG_DWORD', value: 1 }
- expand: { raw_value: '%windir%\dir', type: 'REG_EXPAND_SZ', value: "{{win_dir_value.stdout_lines[0]}}\\dir" }
- multi: { raw_value: ['a, b', 'c'], type: 'REG_MULTI_SZ', value: ['a, b', 'c'] }
- qword: { raw_value: 1, type: 'REG_QWORD', value: 1 }
- string: { raw_value: 'test', type: 'REG_SZ', value: 'test' }
- sub_keys:
- - nest1
- - nest2
+ exists: true
+ properties:
+ binary: { raw_value: ["0x01", "0x16"], type: 'REG_BINARY', value: [1, 22] }
+ dword: { raw_value: 1, type: 'REG_DWORD', value: 1 }
+ expand: { raw_value: '%windir%\dir', type: 'REG_EXPAND_SZ', value: "{{win_dir_value.stdout_lines[0]}}\\dir" }
+ multi: { raw_value: ['a, b', 'c'], type: 'REG_MULTI_SZ', value: ['a, b', 'c'] }
+ qword: { raw_value: 1, type: 'REG_QWORD', value: 1 }
+ string: { raw_value: 'test', type: 'REG_SZ', value: 'test' }
+ sub_keys:
+ - nest1
+ - nest2
- name: validate test
assert:
@@ -67,21 +71,20 @@
- name: get known reg key with no sub keys but some properties
win_reg_stat:
- key: HKCU:\Test\single
+ path: HKCU:\Test\single
register: actual
- name: set expected value for reg key with no sub keys but some properties
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- properties:
- none: { raw_value: [], type: 'REG_NONE', value: [] }
- none1: { raw_value: ["0x00"], type: 'REG_NONE', value: [0] }
- string1: { raw_value: '', type: 'REG_SZ', value: '' }
- string2: { raw_value: 'abc123', type: 'REG_SZ', value: 'abc123' }
- sub_keys: []
+ exists: true
+ properties:
+ none: { raw_value: [], type: 'REG_NONE', value: [] }
+ none1: { raw_value: ["0x00"], type: 'REG_NONE', value: [0] }
+ string1: { raw_value: '', type: 'REG_SZ', value: '' }
+ string2: { raw_value: 'abc123', type: 'REG_SZ', value: 'abc123' }
+ sub_keys: []
- name: validate test
assert:
@@ -90,17 +93,16 @@
- name: get known reg key without sub keys and properties
win_reg_stat:
- key: HKCU:\Test\nested\nest2
+ path: HKCU:\Test\nested\nest2
register: actual
- name: set expected value for reg key without sub keys or properties
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- properties: {}
- sub_keys: []
+ exists: true
+ properties: {}
+ sub_keys: []
register: expected
- name: validate test
@@ -110,15 +112,14 @@
- name: get non-existant reg key
win_reg_stat:
- key: HKCU:\Test\Thispathwillneverexist
+ path: HKCU:\Test\Thispathwillneverexist
register: actual
- name: set expected value for non-existant reg key
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: false
+ exists: false
- name: validate test
assert:
@@ -127,19 +128,18 @@
- name: get string property
win_reg_stat:
- key: HKCU:\Test\nested
- property: string
+ path: HKCU:\Test\nested
+ name: string
register: actual
- name: set expected string property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: 'test'
- type: 'REG_SZ'
- value: 'test'
+ exists: true
+ raw_value: 'test'
+ type: 'REG_SZ'
+ value: 'test'
- name: validate test
assert:
@@ -148,19 +148,18 @@
- name: get expand string property
win_reg_stat:
- key: HKCU:\Test\nested
- property: expand
+ path: HKCU:\Test\nested
+ name: expand
register: actual
- name: set expected expand string property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: '%windir%\dir'
- type: 'REG_EXPAND_SZ'
- value: "{{win_dir_value.stdout_lines[0]}}\\dir"
+ exists: true
+ raw_value: '%windir%\dir'
+ type: 'REG_EXPAND_SZ'
+ value: "{{win_dir_value.stdout_lines[0]}}\\dir"
- name: validate test
assert:
@@ -169,19 +168,18 @@
- name: get multi string property
win_reg_stat:
- key: HKCU:\Test\nested
- property: multi
+ path: HKCU:\Test\nested
+ name: multi
register: actual
- name: set expected multi string property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: ['a, b', 'c']
- type: 'REG_MULTI_SZ'
- value: ['a, b', 'c']
+ exists: true
+ raw_value: ['a, b', 'c']
+ type: 'REG_MULTI_SZ'
+ value: ['a, b', 'c']
- name: validate test
assert:
@@ -190,19 +188,18 @@
- name: get binary property
win_reg_stat:
- key: HKCU:\Test\nested
- property: binary
+ path: HKCU:\Test\nested
+ name: binary
register: actual
- name: set expected binary property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: ["0x01", "0x16"]
- type: 'REG_BINARY'
- value: [1, 22]
+ exists: true
+ raw_value: ["0x01", "0x16"]
+ type: 'REG_BINARY'
+ value: [1, 22]
- name: validate test
assert:
@@ -211,19 +208,18 @@
- name: get dword property
win_reg_stat:
- key: HKCU:\Test\nested
- property: dword
+ path: HKCU:\Test\nested
+ name: dword
register: actual
- name: set expected dword property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: 1
- type: 'REG_DWORD'
- value: 1
+ exists: true
+ raw_value: 1
+ type: 'REG_DWORD'
+ value: 1
- name: validate test
assert:
@@ -232,19 +228,18 @@
- name: get qword property
win_reg_stat:
- key: HKCU:\Test\nested
- property: qword
+ path: HKCU:\Test\nested
+ name: qword
register: actual
- name: set expected qword property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: 1
- type: 'REG_QWORD'
- value: 1
+ exists: true
+ raw_value: 1
+ type: 'REG_QWORD'
+ value: 1
- name: validate test
assert:
@@ -253,19 +248,18 @@
- name: get none property
win_reg_stat:
- key: HKCU:\Test\single
- property: none
+ path: HKCU:\Test\single
+ name: none
register: actual
- name: set expected none property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: []
- type: 'REG_NONE'
- value: []
+ exists: true
+ raw_value: []
+ type: 'REG_NONE'
+ value: []
- name: validate test
assert:
@@ -274,19 +268,18 @@
- name: get none with value property
win_reg_stat:
- key: HKCU:\Test\single
- property: none1
+ path: HKCU:\Test\single
+ name: none1
register: actual
- name: set expected none with value property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: true
- raw_value: ["0x00"]
- type: 'REG_NONE'
- value: [0]
+ exists: true
+ raw_value: ["0x00"]
+ type: 'REG_NONE'
+ value: [0]
- name: validate test
assert:
@@ -295,16 +288,15 @@
- name: get non-existance property
win_reg_stat:
- key: HKCU:\Test\single
- property: doesnotexist
+ path: HKCU:\Test\single
+ name: doesnotexist
register: actual
- name: set expected non-existance property
set_fact:
expected:
changed: false
- win_reg_stat:
- exists: false
+ exists: false
- name: validate test
assert:
@@ -313,5 +305,5 @@
- name: remove registry entry
win_regedit:
- key: HKCU:\Test
+ path: HKCU:\Test
state: absent