PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/test/integration/roles/test_win_stat/tasks/main.yml

https://github.com/ajanthanm/ansible
YAML | 80 lines | 53 code | 11 blank | 16 comment | 0 complexity | 18130c0d21d30e264c6c0ab9f95d63d8 MD5 | raw file
 1# test code for the win_stat module
 2# (c) 2014, Chris Church <chris@ninemoreminutes.com>
 3
 4# This file is part of Ansible
 5#
 6# Ansible is free software: you can redistribute it and/or modify
 7# it under the terms of the GNU General Public License as published by
 8# the Free Software Foundation, either version 3 of the License, or
 9# (at your option) any later version.
10#
11# Ansible is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
18
19- name: test win_stat module on file
20  win_stat: path="C:/Windows/win.ini"
21  register: win_stat_file
22
23- name: check win_stat file result
24  assert: 
25    that:
26      - "win_stat_file.stat.exists"
27      - "not win_stat_file.stat.isdir"
28      - "win_stat_file.stat.size > 0"
29      - "win_stat_file.stat.md5"
30      - "not win_stat_file|failed"
31      - "not win_stat_file|changed"
32
33- name: test win_stat module on file without md5 and backslashes
34  win_stat: path="C:\Windows\win.ini" get_md5=no
35  register: win_stat_file_no_md5
36
37- name: check win_stat file result without md
38  assert: 
39    that:
40      - "win_stat_file_no_md5.stat.exists"
41      - "not win_stat_file_no_md5.stat.isdir"
42      - "win_stat_file_no_md5.stat.size > 0"
43      - "not win_stat_file_no_md5.stat.md5|default('')"
44      - "not win_stat_file_no_md5|failed"
45      - "not win_stat_file_no_md5|changed"
46
47- name: test win_stat module on directory
48  win_stat: path="C:\\Windows"
49  register: win_stat_dir
50
51- name: check win_stat dir result
52  assert: 
53    that:
54      - "win_stat_dir.stat.exists"
55      - "win_stat_dir.stat.isdir"
56      - "not win_stat_dir|failed"
57      - "not win_stat_dir|changed"
58
59- name: test win_stat module non-existent path
60  win_stat: path="C:/this_file_should_not_exist.txt"
61  register: win_stat_missing
62
63- name: check win_stat missing result
64  assert: 
65    that:
66      - "not win_stat_missing.stat.exists"
67      - "not win_stat_missing|failed"
68      - "not win_stat_missing|changed"
69
70- name: test win_stat module without path argument
71  action: win_stat
72  register: win_stat_no_args
73  ignore_errors: true
74
75- name: check win_stat result witn no path argument
76  assert:
77    that:
78      - "win_stat_no_args|failed"
79      - "win_stat_no_args.msg"
80      - "not win_stat_no_args|changed"