From 4aae3a8c6fe746a92ccef07253ac54323789c725 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Wed, 17 Nov 2021 22:07:11 +0800 Subject: [PATCH] update test --- tests/conftest.py | 8 ++++---- tests/platforms/test_arknights.py | 4 ++-- tests/platforms/test_bilibili.py | 4 ++-- tests/platforms/test_monster-siren.py | 4 ++-- tests/platforms/test_ncm_artist.py | 4 ++-- tests/platforms/test_platform.py | 22 +++++++++++----------- tests/platforms/test_weibo.py | 4 ++-- tests/test_config_manager.py | 4 ++-- tests/test_merge_pic.py | 4 ++-- tests/test_render.py | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b4f939c..c2bce56 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,18 +5,18 @@ import typing if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison @pytest.fixture#(scope="module") def plugin_module(tmpdir): - nonebot.init(hk_reporter_config_path=str(tmpdir)) + nonebot.init(bison_config_path=str(tmpdir)) nonebot.load_plugins('src/plugins') plugins = nonebot.get_loaded_plugins() - plugin = list(filter(lambda x: x.name == 'nonebot_hk_reporter', plugins))[0] + plugin = list(filter(lambda x: x.name == 'nonebot_bison', plugins))[0] return plugin.module @pytest.fixture -def dummy_user_subinfo(plugin_module: 'nonebot_hk_reporter'): +def dummy_user_subinfo(plugin_module: 'nonebot_bison'): user = plugin_module.types.User('123', 'group') return plugin_module.types.UserSubInfo( user=user, diff --git a/tests/platforms/test_arknights.py b/tests/platforms/test_arknights.py index 3999513..a03a410 100644 --- a/tests/platforms/test_arknights.py +++ b/tests/platforms/test_arknights.py @@ -7,12 +7,12 @@ import feedparser if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison from .utils import get_json, get_file @pytest.fixture -def arknights(plugin_module: 'nonebot_hk_reporter'): +def arknights(plugin_module: 'nonebot_bison'): return plugin_module.platform.platform_manager['arknights'] @pytest.fixture(scope='module') diff --git a/tests/platforms/test_bilibili.py b/tests/platforms/test_bilibili.py index 363368e..d04c604 100644 --- a/tests/platforms/test_bilibili.py +++ b/tests/platforms/test_bilibili.py @@ -5,7 +5,7 @@ from httpx import Response if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison from .utils import get_json @@ -14,7 +14,7 @@ def bing_dy_list(): return get_json('bilibili_bing_list.json')['data']['cards'] @pytest.fixture -def bilibili(plugin_module: 'nonebot_hk_reporter'): +def bilibili(plugin_module: 'nonebot_bison'): return plugin_module.platform.platform_manager['bilibili'] @pytest.mark.asyncio diff --git a/tests/platforms/test_monster-siren.py b/tests/platforms/test_monster-siren.py index 832271f..f4979cd 100644 --- a/tests/platforms/test_monster-siren.py +++ b/tests/platforms/test_monster-siren.py @@ -7,12 +7,12 @@ import feedparser if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison from .utils import get_json, get_file @pytest.fixture -def monster_siren(plugin_module: 'nonebot_hk_reporter'): +def monster_siren(plugin_module: 'nonebot_bison'): return plugin_module.platform.platform_manager['monster-siren'] @pytest.fixture(scope='module') diff --git a/tests/platforms/test_ncm_artist.py b/tests/platforms/test_ncm_artist.py index 5813540..f5ed1a2 100644 --- a/tests/platforms/test_ncm_artist.py +++ b/tests/platforms/test_ncm_artist.py @@ -8,10 +8,10 @@ from httpx import Response if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison @pytest.fixture -def ncm_artist(plugin_module: 'nonebot_hk_reporter'): +def ncm_artist(plugin_module: 'nonebot_bison'): return plugin_module.platform.platform_manager['ncm-artist'] @pytest.fixture(scope='module') diff --git a/tests/platforms/test_platform.py b/tests/platforms/test_platform.py index 5397dc6..c8c661b 100644 --- a/tests/platforms/test_platform.py +++ b/tests/platforms/test_platform.py @@ -7,9 +7,9 @@ import pytest if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter - from nonebot_hk_reporter.types import * - from nonebot_hk_reporter.post import Post + import nonebot_bison + from nonebot_bison.types import * + from nonebot_bison.post import Post from time import time now = time() @@ -26,18 +26,18 @@ raw_post_list_2 = raw_post_list_1 + [ ] @pytest.fixture -def dummy_user(plugin_module: 'nonebot_hk_reporter'): +def dummy_user(plugin_module: 'nonebot_bison'): user = plugin_module.types.User('123', 'group') return user @pytest.fixture -def user_info_factory(plugin_module: 'nonebot_hk_reporter', dummy_user): +def user_info_factory(plugin_module: 'nonebot_bison', dummy_user): def _user_info(category_getter, tag_getter): return plugin_module.types.UserSubInfo(dummy_user, category_getter, tag_getter) return _user_info @pytest.fixture -def mock_platform_without_cats_tags(plugin_module: 'nonebot_hk_reporter'): +def mock_platform_without_cats_tags(plugin_module: 'nonebot_bison'): class MockPlatform(plugin_module.platform.platform.NewMessage, plugin_module.platform.platform.TargetMixin): @@ -76,7 +76,7 @@ def mock_platform_without_cats_tags(plugin_module: 'nonebot_hk_reporter'): return MockPlatform() @pytest.fixture -def mock_platform(plugin_module: 'nonebot_hk_reporter'): +def mock_platform(plugin_module: 'nonebot_bison'): class MockPlatform(plugin_module.platform.platform.NewMessage, plugin_module.platform.platform.TargetMixin): @@ -123,7 +123,7 @@ def mock_platform(plugin_module: 'nonebot_hk_reporter'): return MockPlatform() @pytest.fixture -def mock_platform_no_target(plugin_module: 'nonebot_hk_reporter'): +def mock_platform_no_target(plugin_module: 'nonebot_bison'): class MockPlatform(plugin_module.platform.platform.NewMessage, plugin_module.platform.platform.NoTargetMixin): @@ -174,7 +174,7 @@ def mock_platform_no_target(plugin_module: 'nonebot_hk_reporter'): return MockPlatform() @pytest.fixture -def mock_platform_no_target_2(plugin_module: 'nonebot_hk_reporter'): +def mock_platform_no_target_2(plugin_module: 'nonebot_bison'): class MockPlatform(plugin_module.platform.platform.NewMessage, plugin_module.platform.platform.NoTargetMixin): @@ -230,7 +230,7 @@ def mock_platform_no_target_2(plugin_module: 'nonebot_hk_reporter'): return MockPlatform() @pytest.fixture -def mock_status_change(plugin_module: 'nonebot_hk_reporter'): +def mock_status_change(plugin_module: 'nonebot_bison'): class MockPlatform(plugin_module.platform.platform.StatusChange, plugin_module.platform.platform.NoTargetMixin): @@ -359,7 +359,7 @@ async def test_status_change(mock_status_change, user_info_factory): assert(len(res4) == 0) @pytest.mark.asyncio -async def test_group(plugin_module: 'nonebot_hk_reporter', mock_platform_no_target, mock_platform_no_target_2, user_info_factory): +async def test_group(plugin_module: 'nonebot_bison', mock_platform_no_target, mock_platform_no_target_2, user_info_factory): group_platform = plugin_module.platform.platform.NoTargetGroup([mock_platform_no_target, mock_platform_no_target_2]) res1 = await group_platform.fetch_new_post('dummy', [user_info_factory(lambda _: [1,4], lambda _: [])]) assert(len(res1) == 0) diff --git a/tests/platforms/test_weibo.py b/tests/platforms/test_weibo.py index f7cc715..6473fff 100644 --- a/tests/platforms/test_weibo.py +++ b/tests/platforms/test_weibo.py @@ -9,12 +9,12 @@ import feedparser if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison from .utils import get_json, get_file @pytest.fixture -def weibo(plugin_module: 'nonebot_hk_reporter'): +def weibo(plugin_module: 'nonebot_bison'): return plugin_module.platform.platform_manager['weibo'] @pytest.fixture(scope='module') diff --git a/tests/test_config_manager.py b/tests/test_config_manager.py index 308aff7..cff94fa 100644 --- a/tests/test_config_manager.py +++ b/tests/test_config_manager.py @@ -4,14 +4,14 @@ import typing if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison @pytest.fixture def config(plugin_module): plugin_module.config.start_up() return plugin_module.config.Config() -def test_create_and_get(config: 'nonebot_hk_reporter.config.Config', plugin_module: 'nonebot_hk_reporter'): +def test_create_and_get(config: 'nonebot_bison.config.Config', plugin_module: 'nonebot_bison'): config.add_subscribe( user='123', user_type='group', diff --git a/tests/test_merge_pic.py b/tests/test_merge_pic.py index 9aeb5ec..3ac9a15 100644 --- a/tests/test_merge_pic.py +++ b/tests/test_merge_pic.py @@ -4,7 +4,7 @@ import typing if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison merge_source_9 = [ 'https://wx1.sinaimg.cn/large/0071VPLMgy1gq0vib7zooj30dx0dxmz5.jpg', @@ -23,7 +23,7 @@ merge_source_9 = [ ] @pytest.mark.asyncio -async def test_9_merge(plugin_module: 'nonebot_hk_reporter'): +async def test_9_merge(plugin_module: 'nonebot_bison'): post = plugin_module.post.Post('', '', '', pics=merge_source_9) await post._pic_merge() assert len(post.pics) == 5 diff --git a/tests/test_render.py b/tests/test_render.py index 685f8e0..0d180ff 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -4,11 +4,11 @@ import typing if typing.TYPE_CHECKING: import sys sys.path.append('./src/plugins') - import nonebot_hk_reporter + import nonebot_bison @pytest.mark.asyncio @pytest.mark.render -async def test_render(plugin_module: 'nonebot_hk_reporter'): +async def test_render(plugin_module: 'nonebot_bison'): render = plugin_module.utils.Render() res = await render.text_to_pic('''a\nbbbbbbbbbbbbbbbbbbbbbb\ncd

中文