class BTNAPITest(TrannyTestCase): def setUp(self): self.api = BroadcastTheNet() def test_user_info(self): response = self.api.user_info() self.assertTrue(response) def test_get_newest(self): response = self.api.get_torrents_browse(10) self.assertEqual(10, len(response['torrents'])) 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) def test_find_matches(self): r = [] for release in self.api.find_matches(): r.append(release) self.assertEqual(10, len(r))
class BTNAPITest(TrannyTestCase): def setUp(self): self.api = BroadcastTheNet() def test_user_info(self): response = self.api.user_info() self.assertTrue(response) def test_get_newest(self): response = self.api.get_torrents_browse(10) self.assertEqual(10, len(response['torrents'])) 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) def test_find_matches(self): r = [] for release in self.api.find_matches(): r.append(release) self.assertEqual(10, len(r))
def init_providers(self): """ Initialize and return the API based services. TODO Remove hard coded service names :return: Configured services API's :rtype: []TorrentProvider """ self.services = [] service_list = set(config.find_sections("rss_") + config.find_sections("provider_")) for service_name in service_list: if service_name.startswith("rss_"): self.services.append(RSSFeed(service_name)) elif service_name == "provider_broadcastthenet": from tranny.provider.broadcastthenet import BroadcastTheNet self.services.append(BroadcastTheNet(service_name)) elif service_name == 'provider_ptp': from tranny.provider.ptp import PTP self.services.append(PTP(service_name)) elif service_name == 'provider_hdbits': from tranny.provider.hdbits import HDBits self.services.append(HDBits(service_name)) return self.services
class BTNAPITest(TrannyTestCase): def setUp(self): self.load_config(self.get_fixture("test_config.ini")) self.api = BroadcastTheNet() def test_user_info(self): response = self.api.user_info() self.assertTrue(response) def test_get_newest(self): response = self.api.get_torrents_browse(10) self.assertEqual(10, len(response['torrents'])) def test_get_torrent_url(self): for torrent_id in self.api.get_torrents_browse(1)['torrents'].keys(): url = self.api.get_torrent_url(torrent_id) self.assertTrue(torrent_id in url) def test_find_matches(self): r = [] for release in self.api.find_matches(): r.append(release) self.assertEqual(10, len(r))
def setUp(self): self.api = BroadcastTheNet()
def setUp(self): self.load_config(self.get_fixture("test_config.ini")) self.api = BroadcastTheNet()