Add test that invalid id rises MethodNotAllowedException
#!/usr/bin/env python3 -m pytest
+import pytest
+from trakt.errors import MethodNotAllowedException
+
from plex_trakt_sync.plex_api import PlexLibraryItem
from plex_trakt_sync.trakt_api import TraktApi
@@ -19,3 +22,16 @@ def test_tv_lookup():
te = lookup[1][2].instance
assert te.imdb == 'tt12057922', f"Unexpected! {te}"
+
+
+def test_tv_lookup_by_episode_id():
+ pe = PlexLibraryItem(make(
+ cls='Episode',
+ guid='com.plexapp.agents.thetvdb://77137/1/1?lang=en',
+ type='episode',
+ seasonNumber=1,
+ index=1,
+ ))
+
+ with pytest.raises(MethodNotAllowedException):
+ trakt.find_by_media(pe)
