summaryrefslogtreecommitdiff
path: root/test/integration/targets/win_timezone/tasks/tests.yml
blob: 44059b65aadba89a1090f61b06c089e726aacbee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# NOTE: Set to a known starting value, store original
- name: Change starting timezone to GMT
  win_timezone:
    timezone: GMT Standard Time
  register: original

# NOTE: We don't know if it changed, we don't care
- name: Test GMT timezone
  assert:
    that:
    - original.timezone == 'GMT Standard Time'

- name: Change timezone to GMT+1
  win_timezone:
    timezone: Romance Standard Time
  register: romance

- name: Test GMT+1 timezone
  assert:
    that:
    - romance|changed
    - romance.previous_timezone == 'GMT Standard Time'
    - romance.timezone == 'Romance Standard Time'
  when: not in_check_mode

- name: Test GMT+1 timezone
  assert:
    that:
    - romance|changed
    - romance.previous_timezone == original.timezone
    - romance.timezone == 'Romance Standard Time'
  when: in_check_mode

- name: Change timezone to GMT+1 again
  win_timezone:
    timezone: Romance Standard Time
  register: romance

- name: Test GMT+1 timezone
  assert:
    that:
    - not romance|changed
    - romance.previous_timezone == 'Romance Standard Time'
    - romance.timezone == 'Romance Standard Time'
  when: not in_check_mode

- name: Test GMT+1 timezone
  assert:
    that:
    - romance|changed
    - romance.previous_timezone == original.timezone
    - romance.timezone == 'Romance Standard Time'
  when: in_check_mode

- name: Change timezone to GMT+6
  win_timezone:
    timezone: Central Standard Time
  register: central

- name: Test GMT-6 timezone
  assert:
    that:
    - central|changed
    - central.previous_timezone == 'Romance Standard Time'
    - central.timezone == 'Central Standard Time'
  when: not in_check_mode

- name: Test GMT+1 timezone
  assert:
    that:
    - central|changed
    - central.previous_timezone == original.timezone
    - central.timezone == 'Central Standard Time'
  when: in_check_mode

- name: Change timezone to GMT+666
  win_timezone:
    timezone: Dag's Standard Time
  register: dag
  ignore_errors: yes

- name: Test GMT+666 timezone
  assert:
    that:
    - dag|failed

- name: Restore original timezone
  win_timezone:
    timezone: '{{ original.timezone }}'