Python django.db.models.fields.files.FileField() Examples
The following are 4
code examples of django.db.models.fields.files.FileField().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.db.models.fields.files
, or try the search function
.
Example #1
Source File: test_templatetags.py From python-thumbnails with MIT License | 5 votes |
def test_get_thumbnail_templatetag_with_FileField_as_source(self, mock_get_thumbnail): field = files.FileField() _file = files.FieldFile(field=field, instance=None, name='image.jpg') Template( '{% load thumbnails %}' '{% get_thumbnail image "200x200" as im %}' '{{im.url}}', ).render(Context({ 'image': _file })) mock_get_thumbnail.assert_called_once_with(_file, '200x200')
Example #2
Source File: test_images.py From python-thumbnails with MIT License | 5 votes |
def test_django_image_files(self): from django.db.models.fields import files field = files.FileField() f = SourceFile(files.FieldFile(field=field, instance=None, name=self.FILE_PATH)) self.assertEqual(f.file, self.FILE_PATH) f = SourceFile(files.ImageFieldFile(field=field, instance=None, name=self.FILE_PATH)) self.assertEqual(f.file, self.FILE_PATH)
Example #3
Source File: test_promises.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_FileField(self): lazy_func = lazy(lambda: 'filename.ext', str) self.assertIsInstance(FileField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) self.assertIsInstance(FileField().get_prep_value(lazy_func()), str)
Example #4
Source File: test_promises.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_FileField(self): lazy_func = lazy(lambda: 'filename.ext', str) self.assertIsInstance(FileField().get_prep_value(lazy_func()), str) lazy_func = lazy(lambda: 0, int) self.assertIsInstance(FileField().get_prep_value(lazy_func()), str)