Created
October 23, 2023 20:20
-
-
Save gabigab117/8478b2f88da8ebf42cea3c80399db8d0 to your computer and use it in GitHub Desktop.
Create an image for Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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