From 4d01f18d6a1129fb3f2f0efc4bda31795519fda2 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 13 Nov 2014 11:42:08 -0500 Subject: [PATCH] 4363: Test that munged filenames show up in os.listdir(). --- services/fuse/tests/test_mount.py | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/services/fuse/tests/test_mount.py b/services/fuse/tests/test_mount.py index f9d06de3ac..eb89a2a2ef 100644 --- a/services/fuse/tests/test_mount.py +++ b/services/fuse/tests/test_mount.py @@ -67,9 +67,20 @@ class FuseMountTest(MountTestBase): cw.start_new_file('thing8.txt') cw.write("data 8") + cw.start_new_stream('edgecases') + for f in ":/./../.../-/*/\x01\\/ ".split("/"): + cw.start_new_file(f) + cw.write('x') + self.testcollection = cw.finish() self.api.collections().create(body={"manifest_text":cw.manifest_text()}).execute() + def assertDirContents(self, subdir, expect_content): + path = self.mounttmp + if subdir: + path = os.path.join(path, subdir) + self.assertEqual(sorted(expect_content), sorted(os.listdir(path))) + def runTest(self): # Create the request handler operations = fuse.Operations(os.getuid(), os.getgid()) @@ -83,21 +94,13 @@ class FuseMountTest(MountTestBase): operations.initlock.wait() # now check some stuff - d1 = os.listdir(self.mounttmp) - d1.sort() - self.assertEqual(['dir1', 'dir2', 'thing1.txt', 'thing2.txt'], d1) - - d2 = os.listdir(os.path.join(self.mounttmp, 'dir1')) - d2.sort() - self.assertEqual(['thing3.txt', 'thing4.txt'], d2) - - d3 = os.listdir(os.path.join(self.mounttmp, 'dir2')) - d3.sort() - self.assertEqual(['dir3', 'thing5.txt', 'thing6.txt'], d3) - - d4 = os.listdir(os.path.join(self.mounttmp, 'dir2/dir3')) - d4.sort() - self.assertEqual(['thing7.txt', 'thing8.txt'], d4) + self.assertDirContents(None, ['thing1.txt', 'thing2.txt', + 'edgecases', 'dir1', 'dir2']) + self.assertDirContents('dir1', ['thing3.txt', 'thing4.txt']) + self.assertDirContents('dir2', ['thing5.txt', 'thing6.txt', 'dir3']) + self.assertDirContents('dir2/dir3', ['thing7.txt', 'thing8.txt']) + self.assertDirContents('edgecases', + ":/_/__/.../-/*/\x01\\/ ".split("/")) files = {'thing1.txt': 'data 1', 'thing2.txt': 'data 2', -- 2.30.2