Ticket #22337: FileSystemStorage_deconstruct_tests.patch

File FileSystemStorage_deconstruct_tests.patch, 1018 bytes (added by nliberg, 10 years ago)

Tests for FileSystemStorage decode method

  • tests/file_storage/tests.py

    diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
    index 4ffba85..44960b3 100644
    a b class GetStorageClassTests(SimpleTestCase):  
    6464                'django.core.files.non_existing_storage.NonExistingStorage')
    6565
    6666
     67class FileStorageDecodeTests(unittest.TestCase):
     68
     69    def test_decode(self):
     70        path, args, kwargs = temp_storage.deconstruct()
     71        self.assertEqual(path, "django.core.files.storage.FileSystemStorage")
     72        self.assertEqual(args, [])
     73        self.assertEqual(kwargs, {'location': temp_storage_location})
     74
     75        kwargs_orig = {
     76            'location': temp_storage_location,
     77            'base_url': 'http://myfiles.example.com/'
     78        }
     79        storage = FileSystemStorage(**kwargs_orig)
     80        path, args, kwargs = storage.deconstruct()
     81        self.assertEqual(kwargs, kwargs_orig)
     82
     83
    6784class FileStorageTests(unittest.TestCase):
    6885    storage_class = FileSystemStorage
    6986
Back to Top