44from plugins .test .state import _file as _test_file
55from plugins .test .state import _link as _test_link
66from plugins .test .state import _directory as _test_directory
7+ from plugins .test .state import _present as _test_present
8+ from plugins .test .state import _absent as _test_absent
79
810from ansible .errors import AnsibleTemplateError
911
@@ -28,6 +30,8 @@ def test_empty(self):
2830 self .assertFalse (_test_file (path ))
2931 self .assertFalse (_test_link (path ))
3032 self .assertTrue (_test_directory (path ))
33+ self .assertTrue (_test_present (path ))
34+ self .assertFalse (_test_absent (path ))
3135
3236 def test_explicit (self ):
3337 path_absent = {'path' : 'path' , 'state' : 'absent' }
@@ -50,6 +54,16 @@ def test_explicit(self):
5054 self .assertFalse (_test_directory (path_link ))
5155 self .assertTrue (_test_directory (path_directory ))
5256
57+ self .assertFalse (_test_present (path_absent ))
58+ self .assertTrue (_test_present (path_file ))
59+ self .assertTrue (_test_present (path_link ))
60+ self .assertTrue (_test_present (path_directory ))
61+
62+ self .assertTrue (_test_absent (path_absent ))
63+ self .assertFalse (_test_absent (path_file ))
64+ self .assertFalse (_test_absent (path_link ))
65+ self .assertFalse (_test_absent (path_directory ))
66+
5367 def test_implicit_file (self ):
5468 path_content = {'path' : 'path' , 'content' : 'content' }
5569 path_content_none = {'path' : 'path' , 'content' : None }
@@ -79,6 +93,20 @@ def test_implicit_file(self):
7993 self .assertFalse (_test_directory (path_template ))
8094 self .assertTrue (_test_directory (path_template_none ))
8195
96+ self .assertTrue (_test_present (path_content ))
97+ self .assertTrue (_test_present (path_content_none ))
98+ self .assertTrue (_test_present (path_file ))
99+ self .assertTrue (_test_present (path_file_none ))
100+ self .assertTrue (_test_present (path_template ))
101+ self .assertTrue (_test_present (path_template_none ))
102+
103+ self .assertFalse (_test_absent (path_content ))
104+ self .assertFalse (_test_absent (path_content_none ))
105+ self .assertFalse (_test_absent (path_file ))
106+ self .assertFalse (_test_absent (path_file_none ))
107+ self .assertFalse (_test_absent (path_template ))
108+ self .assertFalse (_test_absent (path_template_none ))
109+
82110 def test_implicit_link (self ):
83111 path_src = {'path' : 'path' , 'src' : 'src' }
84112 path_src_none = {'path' : 'path' , 'src' : None }
@@ -92,6 +120,12 @@ def test_implicit_link(self):
92120 self .assertFalse (_test_directory (path_src ))
93121 self .assertTrue (_test_directory (path_src_none ))
94122
123+ self .assertTrue (_test_present (path_src ))
124+ self .assertTrue (_test_present (path_src_none ))
125+
126+ self .assertFalse (_test_absent (path_src ))
127+ self .assertFalse (_test_absent (path_src_none ))
128+
95129 def test_implicit_directory (self ):
96130 path = {'path' : 'path' }
97131
@@ -100,3 +134,7 @@ def test_implicit_directory(self):
100134 self .assertFalse (_test_link (path ))
101135
102136 self .assertTrue (_test_directory (path ))
137+
138+ self .assertTrue (_test_present (path ))
139+
140+ self .assertFalse (_test_absent (path ))
0 commit comments