From a9ffd1e738cbbca7df3f64bdb693de422f4163cf Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 20 Nov 2021 17:14:34 -0800 Subject: [PATCH] Fix image mixins tests (#856) * Unlock images after edit image test * Enable playlist art mixins tests * Mark all image mixins tests as xfail * Changing images can fail randomly --- tests/test_audio.py | 2 ++ tests/test_collection.py | 1 + tests/test_mixins.py | 3 +++ tests/test_photo.py | 3 +++ tests/test_playlist.py | 5 +++-- tests/test_video.py | 5 ++++- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_audio.py b/tests/test_audio.py index 0c873a56..41363ddb 100644 --- a/tests/test_audio.py +++ b/tests/test_audio.py @@ -85,6 +85,7 @@ def test_audio_Artist_mixins_edit_advanced_settings(artist): test_mixins.edit_advanced_settings(artist) +@pytest.mark.xfail(reason="Changing images fails randomly") def test_audio_Artist_mixins_images(artist): test_mixins.lock_art(artist) test_mixins.lock_poster(artist) @@ -194,6 +195,7 @@ def test_audio_Album_artist(album): artist.title == "Broke For Free" +@pytest.mark.xfail(reason="Changing images fails randomly") def test_audio_Album_mixins_images(album): test_mixins.lock_art(album) test_mixins.lock_poster(album) diff --git a/tests/test_collection.py b/tests/test_collection.py index 7e54a9dc..52666c2b 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -272,6 +272,7 @@ def test_Collection_art(collection): assert not arts # Collection has no default art +@pytest.mark.xfail(reason="Changing images fails randomly") def test_Collection_mixins_images(collection): test_mixins.lock_art(collection) test_mixins.lock_poster(collection) diff --git a/tests/test_mixins.py b/tests/test_mixins.py index acc3d63b..34ca59c5 100644 --- a/tests/test_mixins.py +++ b/tests/test_mixins.py @@ -139,6 +139,9 @@ def _test_mixins_edit_image(obj, attr): # Reset to default image if default_image: set_img_method(default_image) + # Unlock the image + unlock_img_method = getattr(obj, "unlock" + cap_attr) + unlock_img_method() def edit_art(obj): diff --git a/tests/test_photo.py b/tests/test_photo.py index b0d36753..0ad2a524 100644 --- a/tests/test_photo.py +++ b/tests/test_photo.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from urllib.parse import quote_plus +import pytest + from . import test_media, test_mixins @@ -13,6 +15,7 @@ def test_photo_Photoalbum(photoalbum): assert a_pic +@pytest.mark.xfail(reason="Changing images fails randomly") def test_photo_Photoalbum_mixins_images(photoalbum): # test_mixins.lock_art(photoalbum) # Unlocking photoalbum artwork is broken in Plex # test_mixins.lock_poster(photoalbum) # Unlocking photoalbum poster is broken in Plex diff --git a/tests/test_playlist.py b/tests/test_playlist.py index 332344ec..331506f8 100644 --- a/tests/test_playlist.py +++ b/tests/test_playlist.py @@ -273,8 +273,9 @@ def test_Playlist_PlexWebURL(plex, show): playlist.delete() +@pytest.mark.xfail(reason="Changing images fails randomly") def test_Playlist_mixins_images(playlist): - # test_mixins.lock_art(playlist) + test_mixins.lock_art(playlist) test_mixins.lock_poster(playlist) - # test_mixins.edit_art(playlist) + test_mixins.edit_art(playlist) test_mixins.edit_poster(playlist) diff --git a/tests/test_video.py b/tests/test_video.py index 33a4f145..02dec0d6 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -44,6 +44,7 @@ def test_video_Movie_mixins_edit_advanced_settings(movie): test_mixins.edit_advanced_settings(movie) +@pytest.mark.xfail(reason="Changing images fails randomly") def test_video_Movie_mixins_images(movie): test_mixins.lock_art(movie) test_mixins.lock_poster(movie) @@ -788,7 +789,7 @@ def test_video_Show_mixins_edit_advanced_settings(show): test_mixins.edit_advanced_settings(show) -@pytest.mark.xfail(reason="Changing show art fails randomly") +@pytest.mark.xfail(reason="Changing images fails randomly") def test_video_Show_mixins_images(show): test_mixins.lock_art(show) test_mixins.lock_poster(show) @@ -918,6 +919,7 @@ def test_video_Season_episodes(show): assert len(episodes) >= 1 +@pytest.mark.xfail(reason="Changing images fails randomly") def test_video_Season_mixins_images(show): season = show.season(season=1) test_mixins.lock_art(season) @@ -1129,6 +1131,7 @@ def test_video_Episode_unwatched(tvshows): episode.markUnwatched() +@pytest.mark.xfail(reason="Changing images fails randomly") def test_video_Episode_mixins_images(episode): test_mixins.lock_art(episode) test_mixins.lock_poster(episode)