Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2023
1 parent 699fe31 commit 59f7b5b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/unit/views/preview_image_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import pytest
import io

import pytest
from magic import from_buffer
from PIL import Image

from funnel.views.thumbnails import render_project_preview_image


@pytest.mark.usefixtures('project_expo2011', 'all_fixtures')
def test_preview_image_jobs(project_expo2011) -> None:
assert project_expo2011.preview_image is None
render_project_preview_image(project_id=project_expo2011.id)
assert project_expo2011.preview_image is not None


@pytest.mark.usefixtures('project_expo2011', 'all_fixtures')
def test_preview_image_size(project_expo2011) -> None:
render_project_preview_image(project_id=project_expo2011.id)
with Image.open(io.BytesIO(project_expo2011.preview_image)) as preview_image:
assert preview_image.size == (1280, 720)
image_mimetype = from_buffer(io.BytesIO(project_expo2011.preview_image).read(2048), mime=True)
image_mimetype = from_buffer(
io.BytesIO(project_expo2011.preview_image).read(2048), mime=True
)
assert image_mimetype == 'image/png'

0 comments on commit 59f7b5b

Please sign in to comment.