diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-05-06 22:23:23 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-05-06 22:24:39 -0700 |
| commit | f53d1576caab1594b29f6215604ef23ab6e5745e (patch) | |
| tree | 9047cc2d26ef6339df7bb415965e185367de406b /tests | |
| parent | a75318e813c50e16550eb889fa0c375fa19b88b9 (diff) | |
[1.7.x] Fixed #22337: FileSystemStorage marked as deconstructible and tested.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/field_deconstruction/tests.py | 2 | ||||
| -rw-r--r-- | tests/file_storage/tests.py | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py index 2aaaad988b..0cf015ef06 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -3,6 +3,7 @@ import warnings from django.db import models from django.test import TestCase, override_settings from django.utils import six +from django.core.files.storage import FileSystemStorage class FieldDeconstructionTests(TestCase): @@ -141,6 +142,7 @@ class FieldDeconstructionTests(TestCase): self.assertEqual(path, "django.db.models.FileField") self.assertEqual(args, []) self.assertEqual(kwargs, {"upload_to": "foo/bar"}) + # Test max_length field = models.FileField(upload_to="foo/bar", max_length=200) name, path, args, kwargs = field.deconstruct() self.assertEqual(path, "django.db.models.FileField") diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index 4ffba851eb..a0e2e2a6cc 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -64,6 +64,23 @@ class GetStorageClassTests(SimpleTestCase): 'django.core.files.non_existing_storage.NonExistingStorage') +class FileStorageDeconstructionTests(unittest.TestCase): + + def test_deconstruction(self): + path, args, kwargs = temp_storage.deconstruct() + self.assertEqual(path, "django.core.files.storage.FileSystemStorage") + self.assertEqual(args, tuple()) + self.assertEqual(kwargs, {'location': temp_storage_location}) + + kwargs_orig = { + 'location': temp_storage_location, + 'base_url': 'http://myfiles.example.com/' + } + storage = FileSystemStorage(**kwargs_orig) + path, args, kwargs = storage.deconstruct() + self.assertEqual(kwargs, kwargs_orig) + + class FileStorageTests(unittest.TestCase): storage_class = FileSystemStorage |
