Ejemplo n.º 1
0
 def test_get_torrent_by_hash(self):
     torrent = PDbManager.get_torrent_by_hash(self.torrents[2].info_hash)
     self.assertEqual(torrent.info_hash, self.torrents[2].info_hash)
     self.assertEqual(torrent.name, self.torrents[2].name)
     self.assertEqual(torrent.pub_date, self.torrents[2].pub_date)
     self.assertEqual(torrent.size, self.torrents[2].size)
     self.assertEqual(torrent._status, self.torrents[2]._status)
     self.assertEqual(torrent._category, self.torrents[2]._category)
Ejemplo n.º 2
0
    def test_torrents_add(self, mock_rss, mock_client, mock_tf):
        instance_rss = mock_rss.return_value
        instance_rss.items = self.rss_parser_items
        instance_rss.process_items.return_value = True
        mock_tf.return_value = {'tracker_urls': ['http://netloc:8080']}
        nb_torrents_added = torrents_add(False, "indexer_1", ["movies"])
        self.assertTrue(mock_client.called)
        self.assertTrue(mock_rss.called)
        self.assertTrue(mock_tf.called)
        self.assertEqual(nb_torrents_added, 2)

        self.assertEqual(
            PDbManager.get_tracker_by_name("tracker_1").netloc, "netloc:8080")
        self.assertEqual(
            PDbManager.get_torrent_by_hash(
                "85be94b120becfb44f94f97779c61633c7647628").imdb_id, "2438644")

        nb_torrents_added = torrents_add(False, "indexer_1", ["series"])
        self.assertEqual(nb_torrents_added, 0)