Commits

Ryan Kaskel  committed 77db194

Make HashPathStorage tests safe.

  • Participants
  • Parent commits 11bef0c

Comments (0)

Files changed (1)

File storages/tests/hashpath.py

 
 from storages.backends.hashpath import HashPathStorage
 
+TEST_PATH_PREFIX = 'django-storages-test'
+
 
 class HashPathStorageTest(TestCase):
 
     def setUp(self):
-        self.storage = HashPathStorage()
-        
+        self.test_path = os.path.join(settings.MEDIA_ROOT, TEST_PATH_PREFIX)
+        self.storage = HashPathStorage(location=self.test_path)
+
         # make sure the profile upload folder exists
-        if not os.path.exists(settings.MEDIA_ROOT):
-            os.makedirs(settings.MEDIA_ROOT)
-            
+        if not os.path.exists(self.test_path):
+            os.makedirs(self.test_path)
+
     def tearDown(self):
         # remove uploaded profile picture
-        if os.path.exists(settings.MEDIA_ROOT):
-            shutil.rmtree(settings.MEDIA_ROOT)
+        if os.path.exists(self.test_path):
+            shutil.rmtree(self.test_path)
 
     def test_save_same_file(self):
         """