本文整理汇总了Python中monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker.parse_url方法的典型用法代码示例。如果您正苦于以下问题:Python LostFilmTVTracker.parse_url方法的具体用法?Python LostFilmTVTracker.parse_url怎么用?Python LostFilmTVTracker.parse_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker
的用法示例。
在下文中一共展示了LostFilmTVTracker.parse_url方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LostFilmTrackerTest
# 需要导入模块: from monitorrent.plugins.trackers.lostfilm import LostFilmTVTracker [as 别名]
# 或者: from monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker import parse_url [as 别名]
class LostFilmTrackerTest(ReadContentMixin, TestCase):
def setUp(self):
self.tracker_settings = TrackerSettings(10)
self.tracker = LostFilmTVTracker()
self.tracker.tracker_settings = self.tracker_settings
super(LostFilmTrackerTest, self).setUp()
@helper.use_vcr()
def test_login(self):
self.tracker.login(helper.real_login, helper.real_password)
self.assertTrue((self.tracker.c_uid == helper.real_uid) or (self.tracker.c_uid == helper.fake_uid))
self.assertTrue((self.tracker.c_pass == helper.real_pass) or (self.tracker.c_pass == helper.fake_pass))
self.assertTrue((self.tracker.c_usess == helper.real_usess) or (self.tracker.c_usess == helper.fake_usess))
@use_vcr()
def test_fail_login(self):
with self.assertRaises(LostFilmTVLoginFailedException) as cm:
self.tracker.login("admin", "FAKE_PASSWORD")
self.assertEqual(cm.exception.code, 6)
self.assertEqual(cm.exception.text, u'incorrect login/password')
self.assertEqual(cm.exception.message, u'Не удалось войти. Возможно не правильный логин/пароль')
@helper.use_vcr()
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 test_verify_false(self):
self.assertFalse(self.tracker.verify())
@use_vcr()
def test_verify_fail(self):
tracker = LostFilmTVTracker("457686", '1'*32, '2'*32)
tracker.tracker_settings = self.tracker_settings
self.assertFalse(tracker.verify())
def test_parse_correct_title(self):
title = LostFilmTVTracker._parse_title(u'Род человеческий (Extant)')
self.assertEqual(u'Род человеческий', title['name'])
self.assertEqual(u'Extant', title['original_name'])
def test_parse_correct_title_strange(self):
title = LostFilmTVTracker._parse_title(u'Род человеческий')
self.assertEqual(u'Род человеческий', title['original_name'])
@data(('http://www.lostfilm.tv/browse.php?cat=236', True),
('http://www.lostfilm.tv/my.php', False))
@unpack
def test_can_parse_url(self, url, value):
self.assertEqual(value, self.tracker.can_parse_url(url))
@use_vcr()
def test_parse_correct_url(self):
title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=236')
self.assertEqual(u'12 обезьян', title['name'])
self.assertEqual(u'12 Monkeys', title['original_name'])
@use_vcr()
def test_parse_correct_url_issue_22_1(self):
title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=114')
self.assertEqual(u'Дневники вампира', title['name'])
self.assertEqual(u'The Vampire Diaries', title['original_name'])
@use_vcr()
def test_parse_correct_url_issue_22_2(self):
title = self.tracker.parse_url('http://www.lostfilm.tv/browse.php?cat=160')
self.assertEqual(u'Гримм', title['name'])
self.assertEqual(u'Grimm', title['original_name'])
@use_vcr()
def test_parse_incorrect_url_1(self):
url = 'http://www.lostfilm.tv/browse_wrong.php?cat=236'
self.assertIsNone(self.tracker.parse_url(url))
@use_vcr()
def test_parse_incorrect_url_2(self):
url = 'http://www.lostfilm.tv/browse.php?cat=2'
resp = self.tracker.parse_url(url)
self.assertIsNotNone(resp)
self.assertNotEqual(resp.status_code, 200)
@use_vcr()
def test_parse_series(self):
url = 'http://www.lostfilm.tv/browse.php?cat=160'
parsed_url = self.tracker.parse_url(url, True)
self.assertEqual(160, parsed_url['cat'])
self.assertEqual(u'Гримм', parsed_url['name'])
self.assertEqual(u'Grimm', parsed_url['original_name'])
self.assertEqual(88, len(parsed_url['episodes']))
self.assertEqual(4, len(parsed_url['complete_seasons']))
@use_vcr()
def test_parse_series_without_original_name(self):
url = 'http://www.lostfilm.tv/browse.php?cat=129'
parsed_url = self.tracker.parse_url(url, True)
self.assertEqual(129, parsed_url['cat'])
self.assertEqual(u'Касл', parsed_url['name'])
self.assertEqual(u'Castle', parsed_url['original_name'])
self.assertEqual(119, len(parsed_url['episodes']))
#.........这里部分代码省略.........