コード例 #1
0
ファイル: test_mount.py プロジェクト: chapmanb/arvados
 def test_sanitize_filename(self):
     acceptable = [
         "foo.txt",
         ".foo",
         "..foo",
         "...",
         "foo...",
         "foo..",
         "foo.",
         "-",
         "\x01\x02\x03",
     ]
     unacceptable = [
         "f\00",
         "\00\00",
         "/foo",
         "foo/",
         "//",
     ]
     for f in acceptable:
         self.assertEqual(f, fuse.sanitize_filename(f))
     for f in unacceptable:
         self.assertNotEqual(f, fuse.sanitize_filename(f))
         # The sanitized filename should be the same length, though.
         self.assertEqual(len(f), len(fuse.sanitize_filename(f)))
     # Special cases
     self.assertEqual("_", fuse.sanitize_filename(""))
     self.assertEqual("_", fuse.sanitize_filename("."))
     self.assertEqual("__", fuse.sanitize_filename(".."))
コード例 #2
0
ファイル: test_mount.py プロジェクト: WangZhenfei/arvados
 def test_sanitize_filename(self):
     acceptable = [
         "foo.txt",
         ".foo",
         "..foo",
         "...",
         "foo...",
         "foo..",
         "foo.",
         "-",
         "\x01\x02\x03",
         ]
     unacceptable = [
         "f\00",
         "\00\00",
         "/foo",
         "foo/",
         "//",
         ]
     for f in acceptable:
         self.assertEqual(f, fuse.sanitize_filename(f))
     for f in unacceptable:
         self.assertNotEqual(f, fuse.sanitize_filename(f))
         # The sanitized filename should be the same length, though.
         self.assertEqual(len(f), len(fuse.sanitize_filename(f)))
     # Special cases
     self.assertEqual("_", fuse.sanitize_filename(""))
     self.assertEqual("_", fuse.sanitize_filename("."))
     self.assertEqual("__", fuse.sanitize_filename(".."))