Example #1
0
class TestOriginalFilenameRandomFileField(object):
    def setup_method(self, method):
        self.field = OriginalFilenameRandomFileField(upload_to="foo", filename_field="foo_filename")

    def test_init(self):
        assert self.field.upload_to_path == "foo"
        assert self.field.filename_field == "foo_filename"
        assert callable(self.field.upload_to)

    def test_deconstruct(self):
        actual = self.field.deconstruct()

        assert "upload_to" in actual[3]
        assert actual[3]["upload_to"] == "foo"
        assert "filename_field" in actual[3]
        assert actual[3]["filename_field"] == "foo_filename"
Example #2
0
 def setup_method(self, method):
     self.field = OriginalFilenameRandomFileField(upload_to="foo", filename_field="foo_filename")