Skip to content

Commit

Permalink
fill_gallery generates thumbnail synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolerd committed Aug 20, 2015
1 parent 4663494 commit c6507b7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions project/gallery.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from werkzeug.datastructures import FileStorage
from project.models import UploadedImage
from unittest.mock import patch
from project.tasks.uploads import celery_make_thumbnail as make_thumbnail


def load_images(count=100):
for _ in range(count):
with open('testdata/images/face-2.jpg', 'rb') as fp:
file = FileStorage(fp)
UploadedImage.bl.save_image(
image=file,
img_category=UploadedImage.IMG_CATEGORY.gallery,
)
with patch(
target='project.tasks.uploads.celery_make_thumbnail.delay',
new=make_thumbnail,
):
UploadedImage.bl.save_image(
image=file,
img_category=UploadedImage.IMG_CATEGORY.gallery,
)

0 comments on commit c6507b7

Please sign in to comment.