Esempio n. 1
0
    def test_download_info(self):
        url = 'http://www.lostfilm.tv/series/Grimm/seasons'
        tracker = LostFilmTVTracker(helper.real_session)
        tracker.tracker_settings = self.tracker_settings
        downloads = tracker.get_download_info(url, 160, 4, 22)

        assert len(downloads) == 3
        assert [LostFilmQuality.SD, LostFilmQuality.FullHD, LostFilmQuality.HD] == [d.quality for d in downloads]
    def test_login_failed_unknown_2(self):
        mock_tracker = LostFilmTVTracker()
        login_mock = Mock(side_effect=Exception)
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': '******', 'password': '******'})
        assert self.plugin.login() == LoginResult.Unknown

        login_mock.assert_called_with('monitorrent', 'monitorrent')
    def test_login_failed_incorrect_login_password(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        login_mock = Mock(side_effect=LostFilmTVLoginFailedException(3))
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': '******', 'password': '******'})
        assert self.plugin.login() == LoginResult.IncorrentLoginPassword

        login_mock.assert_called_with('monitorrent', 'monitorrent')
    def test_login_success(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        mock_tracker.c_uid = '123456'
        login_mock = Mock()
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({'username': '******', 'password': '******'})
        assert self.plugin.login() == LoginResult.Ok

        login_mock.assert_called_with('monitorrent', 'monitorrent')
    def test_download_info(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=160'
        tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
        tracker.tracker_settings = self.tracker_settings
        downloads = tracker.get_download_info(url, 4, 22)

        self.assertEqual(3, len(downloads))
        if PY3:
            # Python 3.4+
            self.assertCountEqual(['SD', '720p', '1080p'], [d['quality'] for d in downloads])
        else:
            # Python 2.7
            self.assertItemsEqual(['SD', '720p', '1080p'], [d['quality'] for d in downloads])
Esempio n. 6
0
    def test_download_info_2(self):
        url = 'http://www.lostfilm.tv/series/Eureka/seasons'
        tracker = LostFilmTVTracker(helper.real_session)
        tracker.tracker_settings = self.tracker_settings
        downloads_4_9 = tracker.get_download_info(url, 37, 4, 9)

        assert len(downloads_4_9) == 1
        assert downloads_4_9[0].quality == LostFilmQuality.SD

        downloads_4_10 = tracker.get_download_info(url, 37, 4, 10)

        assert len(downloads_4_10) == 2
        assert [d.quality for d in downloads_4_10] == [LostFilmQuality.SD, LostFilmQuality.HD]
    def test_login_failed_unknown_1(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        login_mock = Mock(side_effect=LostFilmTVLoginFailedException(
            1, 'temp_code', 'temp_message'))
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({
            'username': '******',
            'password': '******'
        })
        self.assertEqual(self.plugin.login(), LoginResult.Unknown)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
    def test_login_success(self):
        mock_tracker = LostFilmTVTracker()
        mock_tracker.tracker_settings = self.tracker_settings
        mock_tracker.c_uid = '123456'
        mock_tracker.c_pass = '******'
        mock_tracker.c_uid = 'e9853fcd82cd46a5294349151700643e'
        login_mock = Mock()
        mock_tracker.login = login_mock
        self.plugin.tracker = mock_tracker
        self.plugin.update_credentials({
            'username': '******',
            'password': '******'
        })
        self.assertEqual(self.plugin.login(), LoginResult.Ok)

        login_mock.assert_called_with('monitorrent', 'monitorrent')
    def test_download_info_2(self):
        url = 'http://www.lostfilm.tv/browse.php?cat=37'
        tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
        tracker.tracker_settings = self.tracker_settings
        downloads_4_9 = tracker.get_download_info(url, 4, 9)

        self.assertEqual(1, len(downloads_4_9))
        self.assertEqual('SD', downloads_4_9[0]['quality'])

        downloads_4_10 = tracker.get_download_info(url, 4, 10)

        self.assertEqual(2, len(downloads_4_10))
        if PY3:
            self.assertCountEqual(['SD', '720p'], [d['quality'] for d in downloads_4_10])
        else:
            self.assertItemsEqual(['SD', '720p'], [d['quality'] for d in downloads_4_10])
Esempio n. 10
0
    def test_parse_all_series(self):
        pytest.fail("This test need to be updated")

        error_hrefs = []
        lock = Lock()
        queue = Queue()
        tracker = LostFilmTVTracker()
        threads = []

        def process():
            while True:
                try:
                    url = queue.get(False)
                except Empty:
                    return
                try:
                    tracker.parse_url(url, True)
                except Exception:
                    with lock:
                        error_hrefs.append(url)

        all_series = requests.get('http://www.lostfilm.tv/serials.php')
        soup = get_soup(all_series.text, 'html5')

        mid = soup.find('div', class_='mid')
        series = mid.find_all('a', class_='bb_a')
        for s in series:
            queue.put('http://www.lostfilm.tv' + s.attrs['href'])

        for i in range(0, 20):
            t = Thread(target=process)
            threads.append(t)
            t.start()

        for i in range(0, len(threads)):
            threads[i].join()

        for e in error_hrefs:
            print("Error parse: {0}".format(e))

        self.assertEqual(0, len(error_hrefs))
Esempio n. 11
0
 def test_download_info_3(self):
     url = 'http://www.lostfilm.tv/path/WrongShow/seasons'
     tracker = LostFilmTVTracker(helper.real_session)
     tracker.tracker_settings = self.tracker_settings
     assert tracker.get_download_info(url, 2, 4, 9) is None
Esempio n. 12
0
 def test_verify_success(self):
     tracker = LostFilmTVTracker(helper.real_session)
     tracker.tracker_settings = self.tracker_settings
     assert tracker.verify()
Esempio n. 13
0
 def test_verify_fail(self):
     tracker = LostFilmTVTracker("1234567890abcdefghjklmnopqrstuvuywxyz")
     tracker.tracker_settings = self.tracker_settings
     assert not tracker.verify()
Esempio n. 14
0
 def setup(self):
     self.tracker_settings = TrackerSettings(10, None)
     self.tracker = LostFilmTVTracker()
     self.tracker.tracker_settings = self.tracker_settings
 def test_verify_fail(self):
     tracker = LostFilmTVTracker("457686", '1'*32, '2'*32)
     tracker.tracker_settings = self.tracker_settings
     self.assertFalse(tracker.verify())
 def test_verify(self):
     tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
     tracker.tracker_settings = self.tracker_settings
     self.assertTrue(tracker.verify())
 def setUp(self):
     self.tracker_settings = TrackerSettings(10)
     self.tracker = LostFilmTVTracker()
     self.tracker.tracker_settings = self.tracker_settings
     super(LostFilmTrackerTest, self).setUp()
 def test_download_info_3(self):
     url = 'http://www.lostfilm.tv/browse_wrong.php?cat=2'
     tracker = LostFilmTVTracker(helper.real_uid, helper.real_pass, helper.real_usess)
     tracker.tracker_settings = self.tracker_settings
     self.assertIsNone(tracker.get_download_info(url, 4, 9))