fix tests
This commit is contained in:
@ -53,6 +53,8 @@ class Settings(BaseSettings):
|
||||
RMT_AUDIO_TRACK_EXT: list = ['.mka']
|
||||
# 索引器
|
||||
INDEXER: str = "builtin"
|
||||
# 索引站点,站点域名关键字使用,分隔
|
||||
INDEXER_SITES: str = ""
|
||||
# 消息通知渠道 telegram/wechat
|
||||
MESSAGER: str = "telegram"
|
||||
# WeChat企业ID
|
||||
|
@ -5,7 +5,7 @@ from typing import List, Optional, Tuple, Union
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core import MediaInfo, TorrentInfo
|
||||
from app.core import MediaInfo, TorrentInfo, settings
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase
|
||||
from app.modules.indexer.spider import TorrentSpider
|
||||
@ -74,6 +74,10 @@ class IndexerModule(_ModuleBase):
|
||||
else:
|
||||
search_word = None
|
||||
|
||||
# 未开启的站点不搜索
|
||||
if settings.INDEXER_SITES and not any([s in site.get("domain") for s in settings.INDEXER_SITES.split(',')]):
|
||||
return []
|
||||
|
||||
if search_word \
|
||||
and site.get('language') == "en" \
|
||||
and StringUtils.is_chinese(search_word):
|
||||
|
13
tests/run.py
13
tests/run.py
@ -2,22 +2,27 @@ import unittest
|
||||
|
||||
from tests.test_cookiecloud import CookieCloudTest
|
||||
from tests.test_doubansync import DoubanSyncTest
|
||||
from tests.test_filter import FilterTest
|
||||
from tests.test_metainfo import MetaInfoTest
|
||||
from tests.test_recognize import RecognizeTest
|
||||
from tests.test_transfer import TransferTest
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestSuite()
|
||||
|
||||
# 测试过滤器
|
||||
suite.addTest(FilterTest('test_filter'))
|
||||
# 测试名称识别
|
||||
suite.addTest(MetaInfoTest('test_metainfo'))
|
||||
# 测试媒体识别
|
||||
suite.addTest(RecognizeTest('test_recognize'))
|
||||
# suite.addTest(RecognizeTest('test_recognize'))
|
||||
# 测试CookieCloud同步
|
||||
suite.addTest(CookieCloudTest('test_cookiecloud'))
|
||||
# suite.addTest(CookieCloudTest('test_cookiecloud'))
|
||||
# 测试文件转移
|
||||
suite.addTest(TransferTest('test_transfer'))
|
||||
# suite.addTest(TransferTest('test_transfer'))
|
||||
# 测试豆瓣同步
|
||||
suite.addTest(DoubanSyncTest('test_doubansync'))
|
||||
# suite.addTest(DoubanSyncTest('test_doubansync'))
|
||||
|
||||
# 运行测试
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite)
|
||||
|
@ -14,4 +14,4 @@ class CookieCloudTest(TestCase):
|
||||
|
||||
def test_cookiecloud(self):
|
||||
result = CookieCloudChain().process()
|
||||
self.assertEqual(result[0], True)
|
||||
self.assertTrue(result[0])
|
||||
|
@ -14,4 +14,4 @@ class DoubanSyncTest(TestCase):
|
||||
|
||||
def test_doubansync(self):
|
||||
result = DoubanSyncChain().process()
|
||||
self.assertEqual(result[0], True)
|
||||
self.assertTrue(result[0])
|
||||
|
23
tests/test_filter.py
Normal file
23
tests/test_filter.py
Normal file
@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from app.core import TorrentInfo
|
||||
from app.modules.filter import FilterModule
|
||||
|
||||
|
||||
class FilterTest(TestCase):
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
def tearDown(self) -> None:
|
||||
pass
|
||||
|
||||
def test_filter(self):
|
||||
torrent = TorrentInfo(title="The Wolf Children Ame and Yuki 2012 BluRay 1080p DTS-HDMA5.1 x265.10bit-CHD",
|
||||
description="狼的孩子雨和雪/狼之子雨与雪/Okami kodomo no ame to yuki")
|
||||
_filter = FilterModule()
|
||||
_filter.init_module()
|
||||
result = _filter.filter_torrents(torrent_list=[torrent])
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertEqual(result[0].pri_order, 97)
|
@ -17,4 +17,4 @@ class RecognizeTest(TestCase):
|
||||
result = IdentifyChain().process(title="我和我的祖国 2019")
|
||||
self.assertEqual(str(result.media_info.tmdb_id), '612845')
|
||||
exists = CommonChain().get_no_exists_info(result.media_info)
|
||||
self.assertEqual(exists[0], True)
|
||||
self.assertTrue(exists[0])
|
||||
|
@ -14,4 +14,4 @@ class TransferTest(TestCase):
|
||||
|
||||
def test_transfer(self):
|
||||
result = TransferChain().process()
|
||||
self.assertEqual(result[0], True)
|
||||
self.assertTrue(result)
|
||||
|
Reference in New Issue
Block a user