Пример #1
0
 def test_kat_pagination(self, mock_get):
     mock_response = Mock()
     mock_response.text = self.kat_response
     mock_get.return_value = mock_response
     api = KickAssTorrentApi()
     torrents, num_pages = api.search("Dexter")
     mock_get.assert_called_with('http://kickass.to/search/Dexter/')
     torrents, num_pages = api.search("Dexter", 4)
     mock_get.assert_called_with('http://kickass.to/search/Dexter/4/')
Пример #2
0
 def test_kat_pagination(self, mock_get):
     mock_response = Mock()
     mock_response.text = self.kat_response
     mock_get.return_value = mock_response
     api = KickAssTorrentApi()
     torrents, num_pages = api.search("Dexter")
     mock_get.assert_called_with('http://kickass.to/search/Dexter/')
     torrents, num_pages = api.search("Dexter", 4)
     mock_get.assert_called_with('http://kickass.to/search/Dexter/4/')
Пример #3
0
 def test_kat_search(self, mock_get):
     mock_response = Mock()
     mock_response.text = self.kat_response
     mock_get.return_value = mock_response
     api = KickAssTorrentApi()
     torrents, num_pages = api.search("Dexter")
     self.assertEqual(len(torrents), 25, "25 torrents are found on the first page")
     self.assertEqual(num_pages, 199, "There are 199 pages of results")
     self.assertIsInstance(torrents[0], Torrent, "KickAssTorrentApi.search returns a list of Torrent objects")
     expected_first_torrent_name = "Dexter S08E11 HDTV x264-ASAP[rartv]"
     self.assertEqual(torrents[0].name, expected_first_torrent_name, "Torrent name of the first found torrents matches expected name")