Exemplo n.º 1
0
Arquivo: tests.py Projeto: ar45/django
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    def test_deconstruction(self):
        path, args, kwargs = temp_storage.deconstruct()
        self.assertEqual(path, "django.core.files.storage.FileSystemStorage")
        self.assertEqual(args, ())
        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)
Exemplo n.º 4
0
 def deconstruct(obj):  # pylint: disable=no-self-argument
     path, args, kwargs = FileSystemStorage.deconstruct(obj)
     kwargs["location"] = None
     return (path, args, kwargs)
Exemplo n.º 5
0
 def deconstruct(obj):
     path, args, kwargs = FileSystemStorage.deconstruct(obj)
     kwargs["location"] = None
     return (path, args, kwargs)