35
35
Image = None
36
36
37
37
38
+
FILE_SUFFIX_REGEX = '[A-Za-z0-9]{7}'
39
+
40
+
38
41
class GetStorageClassTests(SimpleTestCase):
39
42
40
43
def test_get_filesystem_storage(self):
@@ -430,10 +433,9 @@ def test_race_condition(self):
430
433
self.thread.start()
431
434
name = self.save_file('conflict')
432
435
self.thread.join()
433
-
self.assertTrue(self.storage.exists('conflict'))
434
-
self.assertTrue(self.storage.exists('conflict_1'))
435
-
self.storage.delete('conflict')
436
-
self.storage.delete('conflict_1')
436
+
files = sorted(os.listdir(self.storage_dir))
437
+
self.assertEqual(files[0], 'conflict')
438
+
six.assertRegex(self, files[1], 'conflict_%s' % FILE_SUFFIX_REGEX)
437
439
438
440
@unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports umasks and chmod.")
439
441
class FileStoragePermissions(unittest.TestCase):
@@ -477,9 +479,10 @@ def test_directory_with_dot(self):
477
479
self.storage.save('dotted.path/test', ContentFile("1"))
478
480
self.storage.save('dotted.path/test', ContentFile("2"))
479
481
482
+
files = sorted(os.listdir(os.path.join(self.storage_dir, 'dotted.path')))
480
483
self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path')))
481
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test')))
482
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/test_1')))
484
+
self.assertEqual(files[0], 'test')
485
+
six.assertRegex(self, files[1], 'test_%s' % FILE_SUFFIX_REGEX)
483
486
484
487
def test_first_character_dot(self):
485
488
"""
@@ -489,8 +492,10 @@ def test_first_character_dot(self):
489
492
self.storage.save('dotted.path/.test', ContentFile("1"))
490
493
self.storage.save('dotted.path/.test', ContentFile("2"))
491
494
492
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test')))
493
-
self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 'dotted.path/.test_1')))
495
+
files = sorted(os.listdir(os.path.join(self.storage_dir, 'dotted.path')))
496
+
self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 'dotted_.path')))
497
+
self.assertEqual(files[0], '.test')
498
+
six.assertRegex(self, files[1], '.test_%s' % FILE_SUFFIX_REGEX)
494
499
495
500
class DimensionClosingBug(unittest.TestCase):
496
501
"""
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