summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-20 09:43:07 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 19:31:10 -0400
commit1bb6ecf6d3b31bd606754ddbd1398550f605d3e5 (patch)
tree46d193785b40853a128f6ddefb08d92b3c3b37bd /tests
parent6a70cb53971a19f2d9e71d5ee24bfb0e844b4d9d (diff)
Refs #9893 -- Removed shims for lack of max_length support in file storage per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/file_storage/models.py17
-rw-r--r--tests/file_storage/tests.py26
2 files changed, 0 insertions, 43 deletions
diff --git a/tests/file_storage/models.py b/tests/file_storage/models.py
index 9ab8dfbfe2..38675a6673 100644
--- a/tests/file_storage/models.py
+++ b/tests/file_storage/models.py
@@ -12,19 +12,6 @@ from django.core.files.storage import FileSystemStorage
from django.db import models
-class OldStyleFSStorage(FileSystemStorage):
- """
- Storage backend without support for the ``max_length`` argument in
- ``get_available_name()`` and ``save()``; for backward-compatibility and
- deprecation testing.
- """
- def get_available_name(self, name):
- return name
-
- def save(self, name, content):
- return super(OldStyleFSStorage, self).save(name, content)
-
-
class CustomValidNameStorage(FileSystemStorage):
def get_valid_name(self, name):
# mark the name to show that this was called
@@ -55,7 +42,3 @@ class Storage(models.Model):
empty = models.FileField(storage=temp_storage)
limited_length = models.FileField(storage=temp_storage, upload_to='tests', max_length=20)
extended_length = models.FileField(storage=temp_storage, upload_to='tests', max_length=300)
- old_style = models.FileField(
- storage=OldStyleFSStorage(location=temp_storage_location),
- upload_to='tests',
- )
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 9aea27420d..8ff3959427 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -9,7 +9,6 @@ import tempfile
import threading
import time
import unittest
-import warnings
from datetime import datetime, timedelta
from django.core.cache import cache
@@ -555,31 +554,6 @@ class FileFieldStorageTests(TestCase):
self.assertEqual(obj.extended_length.read(), b'Same Content')
obj.extended_length.close()
- def test_old_style_storage(self):
- # Testing backward-compatibility with old-style storage backends that
- # don't take ``max_length`` parameter in ``get_available_name()``
- # and save(). A deprecation warning should be raised.
- obj = Storage()
- with warnings.catch_warnings(record=True) as warns:
- warnings.simplefilter('always')
- obj.old_style.save('deprecated_storage_test.txt', ContentFile('Same Content'))
- self.assertEqual(len(warns), 2)
- self.assertEqual(
- str(warns[0].message),
- 'Backwards compatibility for storage backends without support for '
- 'the `max_length` argument in Storage.save() will be removed in '
- 'Django 1.10.'
- )
- self.assertEqual(
- str(warns[1].message),
- 'Backwards compatibility for storage backends without support for '
- 'the `max_length` argument in Storage.get_available_name() will '
- 'be removed in Django 1.10.'
- )
- self.assertEqual(obj.old_style.name, 'tests/deprecated_storage_test.txt')
- self.assertEqual(obj.old_style.read(), b'Same Content')
- obj.old_style.close()
-
def test_filefield_default(self):
# Default values allow an object to access a single file.
temp_storage.save('tests/default.txt', ContentFile('default content'))