Clean up test_server_transcodeImage (#626)

This commit is contained in:
JonnyWong16 2020-12-15 19:46:24 -08:00 committed by GitHub
parent 2d743a5709
commit b3ea71e62c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,21 +56,19 @@ def test_server_url(plex):
assert "ohno" in plex.url("ohno")
def test_server_transcodeImage(tmpdir, plex, show):
def test_server_transcodeImage(tmpdir, plex, movie):
width, height = 500, 500
imgurl = plex.transcodeImage(show.banner, height, width)
gray = imgurl = plex.transcodeImage(show.banner, height, width, saturation=0)
resized_img = download(
imgurl, plex._token, savepath=str(tmpdir), filename="resize_image"
)
original_url = plex.url(movie.thumb)
resize_url = plex.transcodeImage(movie.thumb, height, width)
grayscale_url = plex.transcodeImage(movie.thumb, height, width, saturation=0)
original_img = download(
show._server.url(show.banner),
plex._token,
savepath=str(tmpdir),
filename="original_img",
original_url, plex._token, savepath=str(tmpdir), filename="original_img",
)
resized_img = download(
resize_url, plex._token, savepath=str(tmpdir), filename="resize_image"
)
grayscale_img = download(
gray, plex._token, savepath=str(tmpdir), filename="grayscale_img"
grayscale_url, plex._token, savepath=str(tmpdir), filename="grayscale_img"
)
with Image.open(resized_img) as image:
assert width, height == image.size