Skip to content

Commit

Permalink
Add regression test for #26
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Aug 6, 2022
1 parent 5214119 commit 932c729
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_tasks.py
@@ -0,0 +1,14 @@
from unittest.mock import Mock

import pytest

from pictures import tasks
from tests.testapp.models import SimpleModel


@pytest.mark.django_db
def test_process_picture__file_cannot_be_reopened(image_upload_file):
# regression https://github.com/codingjoe/django-pictures/issues/26
obj = SimpleModel.objects.create(picture=image_upload_file)
setattr(obj.picture.file, "open", Mock(side_effect=ValueError("The file cannot be reopened.")))
tasks._process_picture(obj.picture)

0 comments on commit 932c729

Please sign in to comment.