fix tests

This commit is contained in:
jxxghp
2023-06-07 23:09:36 +08:00
parent 506fd7427f
commit 4a04f4d7cb
8 changed files with 43 additions and 9 deletions

View File

@ -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)

View File

@ -14,4 +14,4 @@ class CookieCloudTest(TestCase):
def test_cookiecloud(self):
result = CookieCloudChain().process()
self.assertEqual(result[0], True)
self.assertTrue(result[0])

View File

@ -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
View 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)

View File

@ -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])

View File

@ -14,4 +14,4 @@ class TransferTest(TestCase):
def test_transfer(self):
result = TransferChain().process()
self.assertEqual(result[0], True)
self.assertTrue(result)