예제 #1
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)
예제 #2
0
 def test_get_tracker_by_name(self):
     tracker = PDbManager.get_tracker_by_name(self.trackers[2].name)
     self.assertEqual(tracker.name, self.trackers[2].name)
     self.assertEqual(tracker.path, self.trackers[2].path)
     self.assertEqual(tracker.netloc, self.trackers[2].netloc)
     self.assertEqual(tracker.scheme, self.trackers[2].scheme)