Skip to content

Instantly share code, notes, and snippets.

@gabigab117
Created October 23, 2023 20:20
Show Gist options
  • Save gabigab117/8478b2f88da8ebf42cea3c80399db8d0 to your computer and use it in GitHub Desktop.
Save gabigab117/8478b2f88da8ebf42cea3c80399db8d0 to your computer and use it in GitHub Desktop.
Create an image for Tests
def create_test_image():
image = Image.new('RGB', (100, 100), color='white')
image_file = BytesIO()
image.save(image_file, format="JPEG")
image_file.seek(0)
file_name = 'test_image.jpg'
uploaded_image = SimpleUploadedFile(name=file_name, content=image_file.getvalue(), content_type='image/jpeg')
return uploaded_image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment