Django testing model with ImageField
For future users, I've solved the problem.You can mock an ImageField
with a SimpleUploadedFile
instance.
test.py
from django.core.files.uploadedfile import SimpleUploadedFilenewPhoto.image = SimpleUploadedFile(name='test_image.jpg', content=open(image_path, 'rb').read(), content_type='image/jpeg')