Revision 2dbc6857 test/ganeti.utils.io_unittest.py
b/test/ganeti.utils.io_unittest.py | ||
---|---|---|
239 | 239 |
self.failUnlessRaises(errors.ProgrammerError, utils.ListVisibleFiles, |
240 | 240 |
"/bin/../tmp") |
241 | 241 |
|
242 |
def testMountpoint(self): |
|
243 |
lvfmp_fn = compat.partial(utils.ListVisibleFiles, |
|
244 |
_is_mountpoint=lambda _: True) |
|
245 |
self.assertEqual(lvfmp_fn(self.path), []) |
|
246 |
|
|
247 |
# Create "lost+found" as a regular file |
|
248 |
self._CreateFiles(["foo", "bar", ".baz", "lost+found"]) |
|
249 |
self.assertEqual(set(lvfmp_fn(self.path)), |
|
250 |
set(["foo", "bar", "lost+found"])) |
|
251 |
|
|
252 |
# Replace "lost+found" with a directory |
|
253 |
laf_path = utils.PathJoin(self.path, "lost+found") |
|
254 |
utils.RemoveFile(laf_path) |
|
255 |
os.mkdir(laf_path) |
|
256 |
self.assertEqual(set(lvfmp_fn(self.path)), set(["foo", "bar"])) |
|
257 |
|
|
258 |
def testLostAndFoundNoMountpoint(self): |
|
259 |
files = ["foo", "bar", ".Hello World", "lost+found"] |
|
260 |
expected = ["foo", "bar", "lost+found"] |
|
261 |
self._test(files, expected) |
|
262 |
|
|
242 | 263 |
|
243 | 264 |
class TestWriteFile(unittest.TestCase): |
244 | 265 |
def setUp(self): |
Also available in: Unified diff