Commit 97b210ca authored by inkhey's avatar inkhey

test reproductability of avatar using same entry seed

parent d7f3737b
Pipeline #148534 failed with stage
in 31 seconds
......@@ -2,6 +2,7 @@ import os
import typing
from PIL import Image
from PIL import ImageChops
import pytest
from pioupiou import FolderAvatarTheme
......@@ -9,13 +10,14 @@ from pioupiou import FolderAvatarTheme
class TestFolderAvatarTheme(object):
@pytest.mark.parametrize(
"folder_path, layers_name, token, saved_file_path, height, width",
"folder_path, layers_name, token, saved_file_path, compared_image_path, height, width",
[
(
"sample/cat_revoy",
["body", "fur", "eyes", "mouth", "accessorie"],
"just a random string",
"/tmp/saved_cat_avatar.png",
"tests/test_img/saved_cat_avatar.png",
256,
256,
),
......@@ -24,6 +26,7 @@ class TestFolderAvatarTheme(object):
["tail", "hoop", "body", "wing", "eyes", "bec", "accessorie"],
"just a random string",
"/tmp/saved_bird_avatar.png",
"tests/test_img/saved_bird_avatar.png",
256,
256,
),
......@@ -32,6 +35,7 @@ class TestFolderAvatarTheme(object):
["legs", "hair", "arms", "body", "eyes", "mouth"],
"just a random string",
"/tmp/saved_monster_avatar.png",
"tests/test_img/saved_monster_avatar.png",
120,
120,
),
......@@ -43,6 +47,7 @@ class TestFolderAvatarTheme(object):
layers_name: typing.List[str],
token: str,
saved_file_path: str,
compared_image_path: str,
height: int,
width: int,
):
......@@ -54,3 +59,7 @@ class TestFolderAvatarTheme(object):
with Image.open(saved_file_path) as avatar:
assert avatar.height == height
assert avatar.width == width
# INFO - G.M - 06/07/2019 - Image should be exactly same as processed one in tests
with Image.open(compared_image_path) as compared_avatar:
diff = ImageChops.difference(avatar, compared_avatar)
assert not diff.getbbox()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment