mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-15 00:17:33 +00:00
Merge remote-tracking branch 'remotes/origin/master' into reviews_extras
This commit is contained in:
commit
3865ab9919
4 changed files with 8 additions and 11 deletions
|
@ -438,7 +438,7 @@ class PlexServer(PlexObject):
|
|||
log.debug('%s %s', method.__name__.upper(), url)
|
||||
headers = self._headers(**headers or {})
|
||||
response = method(url, headers=headers, timeout=timeout, **kwargs)
|
||||
if response.status_code not in (200, 201):
|
||||
if response.status_code not in (200, 201, 204):
|
||||
codename = codes.get(response.status_code)[0]
|
||||
errtext = response.text.replace('\n', ' ')
|
||||
message = '(%s) %s; %s %s' % (response.status_code, codename, response.url, errtext)
|
||||
|
|
|
@ -323,6 +323,8 @@ def patched_http_call(mocker):
|
|||
# Utility Functions
|
||||
# ---------------------------------
|
||||
def is_datetime(value):
|
||||
if value is None:
|
||||
return True
|
||||
return value > MIN_DATETIME
|
||||
|
||||
|
||||
|
|
|
@ -68,8 +68,7 @@ def test_audio_Album_attrs(album):
|
|||
assert utils.is_metadata(album.key)
|
||||
assert utils.is_int(album.librarySectionID)
|
||||
assert album.listType == "audio"
|
||||
if album.originallyAvailableAt:
|
||||
assert utils.is_datetime(album.originallyAvailableAt)
|
||||
assert utils.is_datetime(album.originallyAvailableAt)
|
||||
assert utils.is_metadata(album.parentKey)
|
||||
assert utils.is_int(album.parentRatingKey)
|
||||
if album.parentThumb:
|
||||
|
@ -223,8 +222,7 @@ def test_audio_Track_attrs(album):
|
|||
assert int(track.index) == 1
|
||||
assert utils.is_metadata(track._initpath)
|
||||
assert utils.is_metadata(track.key)
|
||||
if track.lastViewedAt:
|
||||
assert utils.is_datetime(track.lastViewedAt)
|
||||
assert utils.is_datetime(track.lastViewedAt)
|
||||
assert utils.is_int(track.librarySectionID)
|
||||
assert track.listType == "audio"
|
||||
# Assign 0 track.media
|
||||
|
|
|
@ -171,8 +171,7 @@ def test_video_Movie_attrs(movies):
|
|||
assert movie.guid == "com.plexapp.agents.imdb://tt1172203?lang=en"
|
||||
assert utils.is_metadata(movie._initpath)
|
||||
assert utils.is_metadata(movie.key)
|
||||
if movie.lastViewedAt:
|
||||
assert utils.is_datetime(movie.lastViewedAt)
|
||||
assert utils.is_datetime(movie.lastViewedAt)
|
||||
assert int(movie.librarySectionID) >= 1
|
||||
assert movie.listType == "video"
|
||||
assert movie.originalTitle is None
|
||||
|
@ -496,8 +495,7 @@ def test_video_Show_attrs(show):
|
|||
assert utils.is_metadata(show._initpath)
|
||||
assert utils.is_int(show.index)
|
||||
assert utils.is_metadata(show.key)
|
||||
if show.lastViewedAt:
|
||||
assert utils.is_datetime(show.lastViewedAt)
|
||||
assert utils.is_datetime(show.lastViewedAt)
|
||||
assert utils.is_int(show.leafCount)
|
||||
assert show.listType == "video"
|
||||
assert len(show.locations[0]) >= 10
|
||||
|
@ -770,8 +768,7 @@ def test_video_Season_attrs(show):
|
|||
assert season.index == 1
|
||||
assert utils.is_metadata(season._initpath)
|
||||
assert utils.is_metadata(season.key)
|
||||
if season.lastViewedAt:
|
||||
assert utils.is_datetime(season.lastViewedAt)
|
||||
assert utils.is_datetime(season.lastViewedAt)
|
||||
assert utils.is_int(season.leafCount, gte=3)
|
||||
assert season.listType == "video"
|
||||
assert utils.is_metadata(season.parentKey)
|
||||
|
|
Loading…
Reference in a new issue