diff options
author | Dag Wieers <dag@wieers.com> | 2017-02-02 10:29:56 +0100 |
---|---|---|
committer | John R Barker <john@johnrbarker.com> | 2017-02-02 10:29:56 +0100 |
commit | 3dbce15ccb79e068d8449cc327bea32e73aefe7b (patch) | |
tree | 8ccda811dfab0b251788f0744deff1001c42fc2d /test | |
parent | afe29977cbe5e94a7760039f26213f6062d1d839 (diff) | |
download | ansible-3dbce15ccb79e068d8449cc327bea32e73aefe7b.tar.gz |
win_shortcut: Add missing $check_mode definition + bugfix + tests (#20911)
* win_shortcut: Add missing $check_mode definition
For some reason this entry was missing, possible a merge-conflict gone
wrong :-(
* Added integration tests and bugfix
Add missing changes.
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/win_shortcut/aliases | 1 | ||||
-rw-r--r-- | test/integration/targets/win_shortcut/tasks/main.yml | 157 | ||||
-rw-r--r-- | test/integration/test_win_group2.yml | 1 |
3 files changed, 159 insertions, 0 deletions
diff --git a/test/integration/targets/win_shortcut/aliases b/test/integration/targets/win_shortcut/aliases new file mode 100644 index 0000000000..1ab6431271 --- /dev/null +++ b/test/integration/targets/win_shortcut/aliases @@ -0,0 +1 @@ +windows/ci/group2
\ No newline at end of file diff --git a/test/integration/targets/win_shortcut/tasks/main.yml b/test/integration/targets/win_shortcut/tasks/main.yml new file mode 100644 index 0000000000..26f6cd8f71 --- /dev/null +++ b/test/integration/targets/win_shortcut/tasks/main.yml @@ -0,0 +1,157 @@ +- name: Clean up Ansible website link + win_file: + path: '%UserProfile%\Desktop\Ansible website.url' + state: absent + +- name: Add Ansible website link on the desktop + win_shortcut: + src: 'https://ansible.com/' + dest: '%UserProfile%\Desktop\Ansible website.url' + state: present + register: ansible_website_link_add + +- name: Check there was a change + assert: + that: + - ansible_website_link_add.changed == true + +- name: Add Ansible website link on the desktop again + win_shortcut: + src: 'https://ansible.com/' + dest: '%UserProfile%\Desktop\Ansible website.url' + state: present + register: ansible_website_link_add_again + +- name: Check there was no change + assert: + that: + - ansible_website_link_add_again.changed == false + +- name: Remove link + win_shortcut: + dest: '%UserProfile%\Desktop\Ansible website.url' + state: absent + register: ansible_website_link_remove + +- name: Check there was a change + assert: + that: + - ansible_website_link_remove.changed == true + +- name: Remove link again + win_shortcut: + dest: '%UserProfile%\Desktop\Ansible website.url' + state: absent + register: ansible_website_link_remove_again + +- name: Check there was no change + assert: + that: + - ansible_website_link_remove_again.changed == false + +- name: Clean up Registry Editor shortcut + win_file: + path: '%Public%\Desktop\Registry Editor.lnk' + state: absent + +- name: Add a regedit shortcut on the desktop + win_shortcut: + description: "Registry Editor" + src: regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + state: present + register: regedit_shortcut_add + +- name: Check there was a change + assert: + that: + - regedit_shortcut_add.changed == true + +- name: Add a regedit shortcut on the desktop again + win_shortcut: + description: "Registry Editor" + src: regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + state: present + register: regedit_shortcut_add_again + +- name: Check there was no change + assert: + that: + - regedit_shortcut_add_again.changed == false + +- name: Update a regedit shortcut on the desktop + win_shortcut: + description: "Registry Editor" + src: C:\BogusPath\regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + state: present + register: regedit_shortcut_update + +- name: Check there was a change + assert: + that: + - regedit_shortcut_update.changed == true + +- name: Update a regedit shortcut on the desktop again + win_shortcut: + description: "Registry Editor" + src: C:\BogusPath\regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + state: present + register: regedit_shortcut_update_again + +- name: Check there was no change + assert: + that: + - regedit_shortcut_update_again.changed == false + +- name: Add an (explicit) icon + win_shortcut: + description: "Registry Editor" + src: C:\Windows\regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + icon: 'C:\Windows\regedit.exe,0' + state: present + register: regedit_shortcut_add_icon + +- name: Check there was a change + assert: + that: + - regedit_shortcut_add_icon.changed == true + +- name: Add an (explicit) icon again + win_shortcut: + description: "Registry Editor" + src: C:\Windows\regedit.exe + dest: '%Public%\Desktop\Registry Editor.lnk' + icon: 'C:\Windows\regedit.exe,0' + state: present + register: regedit_shortcut_add_icon_again + +- name: Check there was no change + assert: + that: + - regedit_shortcut_add_icon_again.changed == false + +- name: Remove shortcut + win_shortcut: + dest: '%Public%\Desktop\Registry Editor.lnk' + state: absent + register: regedit_shortcut_remove + +- name: Check there was a change + assert: + that: + - regedit_shortcut_remove.changed == true + +- name: Remove shortcut again + win_shortcut: + dest: '%Public%\Desktop\Registry Editor.lnk' + state: absent + register: regedit_shortcut_remove_again + +- name: Check there was no change + assert: + that: + - regedit_shortcut_remove_again.changed == false
\ No newline at end of file diff --git a/test/integration/test_win_group2.yml b/test/integration/test_win_group2.yml index 94724ad073..27765ea599 100644 --- a/test/integration/test_win_group2.yml +++ b/test/integration/test_win_group2.yml @@ -11,3 +11,4 @@ - { role: win_msi, tags: test_win_msi } - { role: win_package, tags: test_win_package } - { role: win_path, tags: test_win_path } + - { role: win_shortcut, tags: test_win_shortcut } |