2017-08-30 01:19:18 +02:00
|
|
|
- name: Warn user
|
|
|
|
win_toast:
|
2017-08-30 08:30:03 +02:00
|
|
|
expire: 10
|
2017-08-30 01:19:18 +02:00
|
|
|
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:
|
2017-08-30 08:30:03 +02:00
|
|
|
expire: 10
|
2017-08-30 01:19:18 +02:00
|
|
|
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
|