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 8260fdc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_tasks.py
@@ -0,0 +1,18 @@
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 8260fdc

Please sign in to comment.