Skip to content

Commit 31d261b

Browse files
author
Touchstone64
committed
Add unit tests for all permutations
1 parent 6d600fe commit 31d261b

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

tests/test_video.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from urllib.parse import quote_plus
55

66
import pytest
7+
import plexapi.base
78
from plexapi.exceptions import BadRequest, NotFound
89
from plexapi.sync import VIDEO_QUALITY_3_MBPS_720p
910

@@ -957,6 +958,30 @@ def test_video_Show_isPlayed(show):
957958
assert not show.isPlayed
958959

959960

961+
def test_video_Show_season_guids(show):
962+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.add('guids')
963+
try:
964+
season = show.season("Season 1")
965+
assert season.guids
966+
seasons = show.seasons()
967+
assert len(seasons) > 0
968+
assert seasons[0].guids
969+
finally:
970+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.remove('guids')
971+
972+
973+
def test_video_Show_episode_guids(show):
974+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.add('guids')
975+
try:
976+
episode = show.episode("Winter Is Coming")
977+
assert episode.guids
978+
episodes = show.episodes()
979+
assert len(episodes) > 0
980+
assert episodes[0].guids
981+
finally:
982+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.remove('guids')
983+
984+
960985
def test_video_Show_section(show):
961986
section = show.section()
962987
assert section.title == "TV Shows"
@@ -1142,6 +1167,7 @@ def test_video_Season_show(show):
11421167
season_by_name = show.season("Season 1")
11431168
assert show.ratingKey == season.parentRatingKey and season_by_name.parentRatingKey
11441169
assert season.ratingKey == season_by_name.ratingKey
1170+
assert season.guids
11451171

11461172

11471173
def test_video_Season_watched(show):
@@ -1178,6 +1204,29 @@ def test_video_Season_episode(show):
11781204
def test_video_Season_episodes(show):
11791205
episodes = show.season("Season 2").episodes()
11801206
assert len(episodes) >= 1
1207+
1208+
1209+
def test_video_Season_episode_guids(show):
1210+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.add('guids')
1211+
try:
1212+
season = show.season("Season 1")
1213+
episode = season.episode("Winter Is Coming")
1214+
assert episode.guids
1215+
episodes = season.episodes()
1216+
assert len(episodes) > 0
1217+
assert episodes[0].guids
1218+
finally:
1219+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.remove('guids')
1220+
1221+
1222+
def test_video_Season_show_guids(show):
1223+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.add('guids')
1224+
try:
1225+
a_show = show.season("Season 1").show()
1226+
assert a_show
1227+
assert 'tmdb://1399' in [i.id for i in a_show.guids]
1228+
finally:
1229+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.remove('guids')
11811230

11821231

11831232
@pytest.mark.xfail(reason="Changing images fails randomly")
@@ -1250,6 +1299,31 @@ def test_video_Episode(show):
12501299
show.episode(season=1337, episode=1337)
12511300

12521301

1302+
def test_video_Episode_parent_guids(show):
1303+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.add('guids')
1304+
try:
1305+
episodes = show.episodes()
1306+
assert episodes
1307+
episode = episodes[0]
1308+
assert episode
1309+
assert episode.isPartialObject()
1310+
season = episode._season
1311+
assert season
1312+
assert season.isPartialObject()
1313+
assert season.guids
1314+
season = episode.season()
1315+
assert season
1316+
assert season.isPartialObject()
1317+
assert season.guids
1318+
show = episode.show()
1319+
assert show
1320+
assert show.isPartialObject()
1321+
assert show.guids
1322+
finally:
1323+
plexapi.base.USER_DONT_RELOAD_FOR_KEYS.remove('guids')
1324+
1325+
1326+
12531327
def test_video_Episode_hidden_season(episode):
12541328
assert episode.skipParent is False
12551329
assert episode.parentRatingKey

0 commit comments

Comments
 (0)