diff --git a/tests/conftest.py b/tests/conftest.py index d1493002c..da2ab1340 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/test_audio.py b/tests/test_audio.py index 3abfdbe5f..1e1e1d35f 100644 --- a/tests/test_audio.py +++ b/tests/test_audio.py @@ -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 diff --git a/tests/test_video.py b/tests/test_video.py index 2c46a56c0..21ca259b2 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -169,8 +169,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 @@ -494,8 +493,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 @@ -768,8 +766,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)