当前位置: 首页>>代码示例>>Python>>正文


Python LostFilmTVTracker.verify方法代码示例

本文整理汇总了Python中monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker.verify方法的典型用法代码示例。如果您正苦于以下问题:Python LostFilmTVTracker.verify方法的具体用法?Python LostFilmTVTracker.verify怎么用?Python LostFilmTVTracker.verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker的用法示例。


在下文中一共展示了LostFilmTVTracker.verify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_verify

# 需要导入模块: from monitorrent.plugins.trackers.lostfilm import LostFilmTVTracker [as 别名]
# 或者: from monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker import verify [as 别名]
 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())
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:6,代码来源:test_lostfilmtracker.py

示例2: test_verify_fail

# 需要导入模块: from monitorrent.plugins.trackers.lostfilm import LostFilmTVTracker [as 别名]
# 或者: from monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker import verify [as 别名]
 def test_verify_fail(self):
     tracker = LostFilmTVTracker("457686", '1'*32, '2'*32)
     tracker.tracker_settings = self.tracker_settings
     self.assertFalse(tracker.verify())
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:6,代码来源:test_lostfilmtracker.py

示例3: LostFilmTrackerTest

# 需要导入模块: from monitorrent.plugins.trackers.lostfilm import LostFilmTVTracker [as 别名]
# 或者: from monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker import verify [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']))
#.........这里部分代码省略.........
开发者ID:Avatarchik,项目名称:monitorrent,代码行数:103,代码来源:test_lostfilmtracker.py


注:本文中的monitorrent.plugins.trackers.lostfilm.LostFilmTVTracker.verify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。