40
40
Image = None
41
41
42
42
43
+
FILE_SUFFIX_REGEX = '[A-Za-z0-9]{7}'
44
+
45
+
43
46
class GetStorageClassTests(SimpleTestCase):
44
47
45
48
def test_get_filesystem_storage(self):
@@ -431,10 +434,9 @@ def test_race_condition(self):
431
434
self.thread.start()
432
435
name = self.save_file('conflict')
433
436
self.thread.join()
434
-
self.assertTrue(self.storage.exists('conflict'))
435
-
self.assertTrue(self.storage.exists('conflict_1'))
436
-
self.storage.delete('conflict')
437
-
self.storage.delete('conflict_1')
437
+
files = sorted(os.listdir(self.storage_dir))
438
+
self.assertEqual(files[0], 'conflict')
439
+
six.assertRegex(self, files[1], 'conflict_%s' % FILE_SUFFIX_REGEX)
438
440
439
441
@unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports umasks and chmod.")
440
442
class FileStoragePermissions(unittest.TestCase):
@@ -478,9 +480,10 @@ def test_directory_with_dot(self):
478
480
self.storage.save('dotted.path/test', ContentFile("1"))
479
481
self.storage.save('dotted.path/test', ContentFile("2"))
480
482
483
+
files = sorted(os.listdir(os.path.join(self.storage_dir, 'dotted.path')))
481
484
self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path')))
482
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test')))
483
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test_1')))
485
+
self.assertEqual(files[0], 'test')
486
+
six.assertRegex(self, files[1], 'test_%s' % FILE_SUFFIX_REGEX)
484
487
485
488
def test_first_character_dot(self):
486
489
"""
@@ -490,8 +493,10 @@ def test_first_character_dot(self):
490
493
self.storage.save('dotted.path/.test', ContentFile("1"))
491
494
self.storage.save('dotted.path/.test', ContentFile("2"))
492
495
493
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test')))
494
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
496
+
files = sorted(os.listdir(os.path.join(self.storage_dir, 'dotted.path')))
497
+
self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path')))
498
+
self.assertEqual(files[0], '.test')
499
+
six.assertRegex(self, files[1], '.test_%s' % FILE_SUFFIX_REGEX)
495
500
496
501
class DimensionClosingBug(unittest.TestCase):
497
502
"""
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4