-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
699fe31
commit 59f7b5b
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |