1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_toast/tasks/tests.yml
jhawkesworth 8f9b885113 Windows: A module for creating Toast notifications on Modern Windows versions. (#26675)
* replace duff commit version of win_toast

* change expire_mins to expire_secs and add example showing use of async

* fix metadata version to keep sanity --test validate-modules happy

* code review fixes and change expire_secs to expire_seconds

* add first pass integration tests for win_toast

* win_toast no longer fails if there are no logged in users to notify (it sets a toast_sent false if this happens)

* yaml lint clean up of setup.yml in win_toast integration tests

* improve exception and stack trace if the notifier cannot be created, following feedback from dag

* removed unwanted 'echo' input parameters from return vals; added to CHANGELOG.md, removed _seconds units from module params; updated tests to match
2017-08-29 19:19:18 -04:00

106 lines
2.5 KiB
YAML

- name: Warn user
win_toast:
expire_seconds: 10
msg: Keep calm and carry on.
register: msg_result
ignore_errors: True
- name: Test msg_result when can_toast is true (normal mode, users)
assert:
that:
- not msg_result|failed
- msg_result.time_taken > 10
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int > 0
- name: Test msg_result when can_toast is true (normal mode, no users)
assert:
that:
- not msg_result|failed
- msg_result.time_taken > 0.1
- msg_result.toast_sent == False
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int == 0
- name: Test msg_result when can_toast is true (check mode, users)
assert:
that:
- not msg_result|failed
- msg_result.time_taken > 0.1
when:
- can_toast == True
- in_check_mode == True
- name: Test msg_result when can_toast is true (check mode, no users)
assert:
that:
- not msg_result|failed
- msg_result.time_taken > 0.1
- msg_result.toast_sent == False
when:
- can_toast == True
- in_check_mode == True
- user_count.stdout|int == 0
- name: Test msg_result when can_toast is false
assert:
that:
- msg_result|failed
when: can_toast == False
- name: Warn user again
win_toast:
expire_seconds: 10
msg: Keep calm and carry on.
register: msg_result2
ignore_errors: True
- name: Test msg_result2 when can_toast is true (normal mode, users)
assert:
that:
- not msg_result2|failed
- msg_result2.time_taken > 10
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int > 0
- name: Test msg_result2 when can_toast is true (normal mode, no users)
assert:
that:
- not msg_result2|failed
- msg_result2.time_taken > 0.1
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int == 0
- name: Test msg_result2 when can_toast is true (check mode, users)
assert:
that:
- not msg_result2|failed
- msg_result2.time_taken > 0.1
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int > 0
- name: Test msg_result2 when can_toast is true (check mode, no users)
assert:
that:
- not msg_result2|failed
- msg_result2.time_taken > 0.1
when:
- can_toast == True
- in_check_mode == False
- user_count.stdout|int == 0
- name: Test msg_result2 when can_toast is false
assert:
that:
- msg_result2|failed
when: can_toast == False