mirror of
https://github.com/ae-utbm/sith.git
synced 2026-06-04 23:29:24 +00:00
WIP
This commit is contained in:
+27
-8
@@ -1,17 +1,36 @@
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.conf import settings
|
||||
from model_bakery import seq
|
||||
from model_bakery.recipe import Recipe, foreign_key
|
||||
|
||||
from core.utils import RED_PIXEL_PNG
|
||||
from sas.models import Album, Picture
|
||||
|
||||
album_recipe = Recipe(Album, is_moderated=True, name=seq("Album "))
|
||||
album_recipe = Recipe(
|
||||
Album,
|
||||
name=seq("Album "),
|
||||
thumbnail=SimpleUploadedFile(
|
||||
name="thumb.webp", content=b"", content_type="image/webp"
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
picture_recipe = Recipe(
|
||||
Picture, is_moderated=True, album=foreign_key(album_recipe), name=seq("Picture ")
|
||||
Picture,
|
||||
is_moderated=True,
|
||||
name=seq("Picture "),
|
||||
original=SimpleUploadedFile(
|
||||
# compressed and thumbnail are generated on save (except if bulk creating).
|
||||
# For this step no to fail, original must be a valid image.
|
||||
name="img.png",
|
||||
content=RED_PIXEL_PNG,
|
||||
content_type="image/png",
|
||||
),
|
||||
compressed=SimpleUploadedFile(
|
||||
name="img.webp", content=b"", content_type="image/webp"
|
||||
),
|
||||
thumbnail=SimpleUploadedFile(
|
||||
name="img.webp", content=b"", content_type="image/webp"
|
||||
),
|
||||
)
|
||||
"""A SAS Picture fixture.
|
||||
|
||||
Warnings:
|
||||
If you don't `bulk_create` this, you need
|
||||
to explicitly set the parent album, or it won't work
|
||||
"""
|
||||
"""A SAS Picture fixture."""
|
||||
|
||||
Reference in New Issue
Block a user