Revision 04a69a18

b/lib/utils.py
1221 1221
  @param path: the directory to enumerate
1222 1222
  @rtype: list
1223 1223
  @return: the list of all files not starting with a dot
1224
  @raise ProgrammerError: if L{path} is not an absolue and normalized path
1224 1225

  
1225 1226
  """
1227
  if not IsNormAbsPath(path):
1228
    raise errors.ProgrammerError("Path passed to ListVisibleFiles is not"
1229
                                 " absolute/normalized: '%s'" % path)
1226 1230
  files = [i for i in os.listdir(path) if not i.startswith(".")]
1227 1231
  files.sort()
1228 1232
  return files
b/test/ganeti.utils_unittest.py
897 897
    expected = ["a", "b"]
898 898
    self._test(files, expected)
899 899

  
900
  def testNonAbsolutePath(self):
901
    self.failUnlessRaises(errors.ProgrammerError, ListVisibleFiles, "abc")
902

  
903
  def testNonNormalizedPath(self):
904
    self.failUnlessRaises(errors.ProgrammerError, ListVisibleFiles,
905
                          "/bin/../tmp")
906

  
900 907

  
901 908
class TestNewUUID(unittest.TestCase):
902 909
  """Test case for NewUUID"""

Also available in: Unified diff