Skip to content

Commit 26e4227

Browse files
committed
Add tests for square art
1 parent 68a95cc commit 26e4227

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/test_mixins.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,16 @@ def lock_poster(obj):
223223
_test_mixins_lock_image(obj, "posters")
224224

225225

226+
def lock_square_art(obj):
227+
_test_mixins_lock_image(obj, "squareArts")
228+
229+
226230
def _test_mixins_edit_image(obj, attr):
227231
cap_attr = attr[:-1].capitalize()
228232
get_img_method = getattr(obj, attr)
229233
set_img_method = getattr(obj, "set" + cap_attr)
230234
upload_img_method = getattr(obj, "upload" + cap_attr)
235+
delete_img_method = getattr(obj, "delete" + cap_attr)
231236
images = get_img_method()
232237
if images:
233238
default_image = images[0]
@@ -270,6 +275,12 @@ def _test_mixins_edit_image(obj, attr):
270275
]
271276
assert file_image
272277

278+
# Test delete image
279+
delete_img_method()
280+
images = get_img_method()
281+
selected_image = next((i for i in images if i.selected), None)
282+
assert selected_image is None
283+
273284
# Reset to default image
274285
if default_image:
275286
set_img_method(default_image)
@@ -287,6 +298,10 @@ def edit_poster(obj):
287298
_test_mixins_edit_image(obj, "posters")
288299

289300

301+
def edit_square_art(obj):
302+
_test_mixins_edit_image(obj, "squareArts")
303+
304+
290305
def _test_mixins_imageUrl(obj, attr):
291306
url = getattr(obj, attr + "Url")
292307
if getattr(obj, attr):
@@ -307,6 +322,10 @@ def attr_posterUrl(obj):
307322
_test_mixins_imageUrl(obj, "thumb")
308323

309324

325+
def attr_squareArtUrl(obj):
326+
_test_mixins_imageUrl(obj, "squareArt")
327+
328+
310329
def _test_mixins_edit_theme(obj):
311330
_fields = lambda: [f.name for f in obj.fields]
312331

tests/test_video.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,10 @@ def test_video_Movie_mixins_edit_advanced_settings(movie):
695695
def test_video_Movie_mixins_images(movie):
696696
test_mixins.lock_art(movie)
697697
test_mixins.lock_poster(movie)
698+
test_mixins.lock_square_art(movie)
698699
test_mixins.edit_art(movie)
699700
test_mixins.edit_poster(movie)
701+
test_mixins.edit_square_art(movie)
700702

701703

702704
def test_video_Movie_mixins_themes(movie):
@@ -962,10 +964,13 @@ def test_video_Show_mixins_edit_advanced_settings(show):
962964
def test_video_Show_mixins_images(show):
963965
test_mixins.lock_art(show)
964966
test_mixins.lock_poster(show)
967+
test_mixins.lock_square_art(show)
965968
test_mixins.edit_art(show)
966969
test_mixins.edit_poster(show)
970+
test_mixins.edit_square_art(show)
967971
test_mixins.attr_artUrl(show)
968972
test_mixins.attr_posterUrl(show)
973+
test_mixins.attr_squareArtUrl(show)
969974

970975

971976
def test_video_Show_mixins_themes(show):
@@ -1119,10 +1124,13 @@ def test_video_Season_mixins_images(show):
11191124
season = show.season(season=1)
11201125
test_mixins.lock_art(season)
11211126
test_mixins.lock_poster(season)
1127+
test_mixins.lock_square_art(season)
11221128
test_mixins.edit_art(season)
11231129
test_mixins.edit_poster(season)
1130+
test_mixins.edit_square_art(season)
11241131
test_mixins.attr_artUrl(season)
11251132
test_mixins.attr_posterUrl(season)
1133+
test_mixins.attr_squareArtUrl(season)
11261134

11271135

11281136
def test_video_Season_mixins_themes(show):
@@ -1337,10 +1345,13 @@ def test_video_Episode_unwatched(tvshows):
13371345
def test_video_Episode_mixins_images(episode):
13381346
test_mixins.lock_art(episode)
13391347
test_mixins.lock_poster(episode)
1348+
test_mixins.lock_square_art(episode)
13401349
# test_mixins.edit_art(episode) # Uploading episode artwork is broken in Plex
13411350
test_mixins.edit_poster(episode)
1351+
test_mixins.edit_square_art(episode)
13421352
test_mixins.attr_artUrl(episode)
13431353
test_mixins.attr_posterUrl(episode)
1354+
test_mixins.attr_squareArtUrl(episode)
13441355

13451356

13461357
def test_video_Episode_mixins_themes(episode):

0 commit comments

Comments
 (0)