From f6b6ed530b473df7937038895e6cadbc1fa5dc0c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 20 Aug 2015 22:02:45 -0400 Subject: [PATCH] added file tests --- lib/ansible/plugins/test/files.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/ansible/plugins/test/files.py diff --git a/lib/ansible/plugins/test/files.py b/lib/ansible/plugins/test/files.py new file mode 100644 index 00000000000..0c46b53160b --- /dev/null +++ b/lib/ansible/plugins/test/files.py @@ -0,0 +1,37 @@ +# (c) 2015, Ansible, Inc +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +from os.path import isdir, isfile, isabs, exists, lexists, islink, samefile, ismount +from ansible import errors + +class TestModule(object): + ''' Ansible file jinja2 tests ''' + + def tests(self): + return { + # file testing + 'is_dir' : isdir, + 'is_file' : isfile, + 'is_link' : islink, + 'exists' : exists, + 'link_exists' : lexists, + + # path testing + 'is_abs' : isabs, + 'is_same_file' : samefile, + 'is_mount' : ismount, + }