示例#1
0
 def test_get_torrent_url(self):
     with tapedeck.use_cassette(self.track("test_get_torrent_url_a")):
         torrent_ids = self.api.get_torrents_browse(1)['torrents'].keys()
     for torrent_id in torrent_ids:
         with tapedeck.use_cassette(self.track("test_get_torrent_url_{}".format(torrent_id))):
             url = self.api.get_torrent_url(torrent_id)
         self.assertTrue(torrent_id in url)
示例#2
0
 def test_get_torrent_url(self):
     with tapedeck.use_cassette(self.track("test_get_torrent_url_a")):
         torrent_ids = self.api.get_torrents_browse(1)['torrents'].keys()
     for torrent_id in torrent_ids:
         with tapedeck.use_cassette(
                 self.track("test_get_torrent_url_{}".format(torrent_id))):
             url = self.api.get_torrent_url(torrent_id)
         self.assertTrue(torrent_id in url)
示例#3
0
 def test_show_episode_summary(self):
     with tapedeck.use_cassette(self.track("test_show_episode_summary_a"), before_record=strip_key):
         daily_summary = trakt.show_episode_summary_daily("The Daily Show", 9, 9, 2014)
     self.assertEqual(daily_summary['episode']['number'], 149)
     self.assertEqual(daily_summary['episode']['season'], 19)
     with tapedeck.use_cassette(self.track("test_show_episode_summary_b"), before_record=strip_key):
         summary = trakt.show_episode_summary(self.show, self.season, self.episode)
     self.assertEqual(summary.get('episode', {}).get('season', 0), self.season)
     self.assertEqual(summary.get('episode', {}).get('number', 0), self.episode)
示例#4
0
 def test_show_episode_summary(self):
     with tapedeck.use_cassette(self.track("test_show_episode_summary_a"),
                                before_record=strip_key):
         daily_summary = trakt.show_episode_summary_daily(
             "The Daily Show", 9, 9, 2014)
     self.assertEqual(daily_summary['episode']['number'], 149)
     self.assertEqual(daily_summary['episode']['season'], 19)
     with tapedeck.use_cassette(self.track("test_show_episode_summary_b"),
                                before_record=strip_key):
         summary = trakt.show_episode_summary(self.show, self.season,
                                              self.episode)
     self.assertEqual(
         summary.get('episode', {}).get('season', 0), self.season)
     self.assertEqual(
         summary.get('episode', {}).get('number', 0), self.episode)
示例#5
0
 def test_show_summary(self):
     # Uses title with space to test slug detection
     with tapedeck.use_cassette(self.track("test_show_summary"),
                                before_record=strip_key):
         self.assertEqual(
             trakt.show_summary("The Simpsons", False).get('tvrage_id', 0),
             6190, False)
 def test_find_slug(self):
     items = [["Shortland Street",  73983]]
     i = 0
     for title, slug in items:
         with tapedeck.use_cassette(self.track("test_find_slug_{}".format(i)), before_record=strip_key):
             found_slug = trakt._find_slug(title, constants.MEDIA_TV)
         self.assertEqual(slug, found_slug, title)
         i += 1
示例#7
0
 def test_find_slug(self):
     items = [["Shortland Street", 73983]]
     i = 0
     for title, slug in items:
         with tapedeck.use_cassette(self.track(
                 "test_find_slug_{}".format(i)),
                                    before_record=strip_key):
             found_slug = trakt._find_slug(title, constants.MEDIA_TV)
         self.assertEqual(slug, found_slug, title)
         i += 1
示例#8
0
 def test_search_tv(self):
     with tapedeck.use_cassette(self.track("test_search_tv"), before_record=strip_key):
         result = trakt.search_tv(self.show)
     self.assertTrue(result)
     self.assertEqual(result['tvrage_id'], self.tvrage_id)
示例#9
0
 def test_search_episode(self):
     with tapedeck.use_cassette(self.track("test_search_episode"), before_record=strip_key):
         results = trakt.search_episode("The Daily Show - 2014-09-09")
     self.assertTrue(results)
示例#10
0
 def test_calendar_premiers(self):
     with tapedeck.use_cassette(self.track("test_calendar_premiers"), before_record=strip_key):
         premiers = trakt.calendar_premiers()
     self.assertTrue(len(premiers) > 0)
示例#11
0
 def test_calendar_shows(self):
     with tapedeck.use_cassette(self.track("test_calendar_shows"), before_record=strip_key):
         shows = trakt.calendar_shows(None, None)
     self.assertEqual(len(shows), 7)
示例#12
0
 def test_show_related(self):
     with tapedeck.use_cassette(self.track("test_show_related"),
                                before_record=strip_key):
         self.assertTrue(len(trakt.show_related(self.show)) >= 10)
示例#13
0
 def test_show_seasons(self):
     with tapedeck.use_cassette(self.track("test_show_seasons"), before_record=strip_key):
         seasons = trakt.show_seasons(self.show)
     self.assertEqual(len(seasons), 10)
示例#14
0
 def test_calendar_shows(self):
     with tapedeck.use_cassette(self.track("test_calendar_shows"),
                                before_record=strip_key):
         shows = trakt.calendar_shows(None, None)
     self.assertEqual(len(shows), 7)
示例#15
0
 def test_download_fail(self):
     with tapedeck.use_cassette(self.track("test_download_fail")):
         status = net.download("bs_name", "http://bs.url.com/blah.torrent")
     self.assertFalse(status)
示例#16
0
 def test_http_request_post(self):
     with tapedeck.use_cassette(self.track("test_http_request_post")):
         resp = net.http_request('https://posttestserver.com/post.php', data={'test': 1}, method='post')
     self.assertTrue("dumped 1" in resp.content)
示例#17
0
 def test_show_season(self):
     with tapedeck.use_cassette(self.track("test_show_season"),
                                before_record=strip_key):
         season = trakt.show_season(self.show, self.season)
     self.assertTrue(len(season) == 23)
示例#18
0
 def test_search_movie(self):
     with tapedeck.use_cassette(self.track("test_search_movie"),
                                before_record=strip_key):
         result = trakt.search_movie(self.movie)
     self.assertTrue(result)
     self.assertEqual(result['imdb_id'], self.imdb_id)
示例#19
0
 def test_search_tv(self):
     with tapedeck.use_cassette(self.track("test_search_tv"),
                                before_record=strip_key):
         result = trakt.search_tv(self.show)
     self.assertTrue(result)
     self.assertEqual(result['tvrage_id'], self.tvrage_id)
示例#20
0
 def test_search_episode(self):
     with tapedeck.use_cassette(self.track("test_search_episode"),
                                before_record=strip_key):
         results = trakt.search_episode("The Daily Show - 2014-09-09")
     self.assertTrue(results)
示例#21
0
 def test_calendar_premiers(self):
     with tapedeck.use_cassette(self.track("test_calendar_premiers"),
                                before_record=strip_key):
         premiers = trakt.calendar_premiers()
     self.assertTrue(len(premiers) > 0)
示例#22
0
 def test_search_movie(self):
     with tapedeck.use_cassette(self.track("test_search_movie"), before_record=strip_key):
         result = trakt.search_movie(self.movie)
     self.assertTrue(result)
     self.assertEqual(result['imdb_id'], self.imdb_id)
示例#23
0
 def test_movie_summary(self):
     with tapedeck.use_cassette(self.track("test_movie_summary"), before_record=strip_key):
         movie = trakt.movie_summary(self.movie)
     self.assertEqual(movie.get('imdb_id', ''), self.imdb_id)
示例#24
0
 def test_show_seasons(self):
     with tapedeck.use_cassette(self.track("test_show_seasons"),
                                before_record=strip_key):
         seasons = trakt.show_seasons(self.show)
     self.assertEqual(len(seasons), 10)
示例#25
0
 def test_get_movie_by_id(self):
     with tapedeck.use_cassette('test_get_movie_by_id.json'):
         movie = imdb.get_movie_by_id(self._id)
     self.assertEqual(self._id, movie.movieID)
示例#26
0
 def test_show_summary(self):
     # Uses title with space to test slug detection
     with tapedeck.use_cassette(self.track("test_show_summary"), before_record=strip_key):
         self.assertEqual(trakt.show_summary("The Simpsons", False).get('tvrage_id', 0), 6190, False)
示例#27
0
 def test_download_ok(self):
     self.tmp_dir = tempfile.mkdtemp()
     with tapedeck.use_cassette(self.track("test_download_ok")):
         self.assertTrue(net.download("test_name", self.url_ok, self.tmp_dir, extension=".test"))
     with open(join(self.tmp_dir, "test_name.test")) as tf:
         self.assertTrue(len(tf.read()))
示例#28
0
 def test_show_related(self):
     with tapedeck.use_cassette(self.track("test_show_related"), before_record=strip_key):
         self.assertTrue(len(trakt.show_related(self.show)) >= 10)
示例#29
0
 def test_show_season(self):
     with tapedeck.use_cassette(self.track("test_show_season"), before_record=strip_key):
         season = trakt.show_season(self.show, self.season)
     self.assertTrue(len(season) == 23)
示例#30
0
 def test_movie_summary(self):
     with tapedeck.use_cassette(self.track("test_movie_summary"),
                                before_record=strip_key):
         movie = trakt.movie_summary(self.movie)
     self.assertEqual(movie.get('imdb_id', ''), self.imdb_id)