diff --git a/tests/unit_tests/api/test_bots_controller_errors.py b/tests/unit_tests/api/test_bots_controller_errors.py index c4949a7f8..1d8730c61 100644 --- a/tests/unit_tests/api/test_bots_controller_errors.py +++ b/tests/unit_tests/api/test_bots_controller_errors.py @@ -114,7 +114,12 @@ async def test_runtime_error_redacts_persisted_secrets_on_partial_update(): ) service = BotService(ap) service.get_bot = AsyncMock( - return_value={'uuid': 'bot-1', 'enable': True, 'adapter_config': {'app_secret': 'persisted-secret-value'}} + return_value={ + 'uuid': 'bot-1', + 'adapter': 'aiocqhttp', + 'enable': True, + 'adapter_config': {'app_secret': 'persisted-secret-value'}, + } ) with pytest.raises(BotApplyError) as captured: await service.update_bot('workspace-test', 'bot-1', {'enable': True}) diff --git a/tests/unit_tests/platform/test_plugin_subscriptions.py b/tests/unit_tests/platform/test_plugin_subscriptions.py index d074bf659..64f56aa57 100644 --- a/tests/unit_tests/platform/test_plugin_subscriptions.py +++ b/tests/unit_tests/platform/test_plugin_subscriptions.py @@ -14,8 +14,13 @@ from langbot.pkg.persistence.tenant_uow import PersistenceScope, PersistenceScop def make_bot(subscriptions): bot = object.__new__(RuntimeBot) - bot.bot_entity = SimpleNamespace(uuid='bot', event_bindings=[], plugin_processors=subscriptions) + bot.bot_entity = SimpleNamespace( + uuid='bot', adapter='aiocqhttp', event_bindings=[], plugin_processors=subscriptions + ) bot.execution_context = 'workspace' + bot.workspace_uuid = 'workspace' + bot.placement_generation = 1 + bot.ap = SimpleNamespace(workspace_service=SimpleNamespace(get_execution_binding=AsyncMock())) bot._record_adapter_event = AsyncMock() bot._record_event_route_trace = AsyncMock() bot.logger = SimpleNamespace(error=AsyncMock()) @@ -124,7 +129,8 @@ async def test_cloud_deliveries_own_their_scope_and_preserve_parent(primary_fail ) bot.ap = SimpleNamespace( - persistence_mgr=SimpleNamespace(mode=SimpleNamespace(value='cloud_runtime'), tenant_scope=tenant_scope) + workspace_service=SimpleNamespace(get_execution_binding=AsyncMock()), + persistence_mgr=SimpleNamespace(mode=SimpleNamespace(value='cloud_runtime'), tenant_scope=tenant_scope), ) seen = [] diff --git a/tests/unit_tests/platform/test_routing_rules.py b/tests/unit_tests/platform/test_routing_rules.py index 08fe64051..c35788a39 100644 --- a/tests/unit_tests/platform/test_routing_rules.py +++ b/tests/unit_tests/platform/test_routing_rules.py @@ -38,6 +38,7 @@ class TestEventRouteTrace: bot = object.__new__(RuntimeBot) bot.bot_entity = SimpleNamespace( uuid='bot-1', + adapter='aiocqhttp', workspace_uuid=TEST_CONTEXT.workspace_uuid, event_bindings=event_bindings, ) @@ -703,7 +704,10 @@ async def test_installed_event_processor_never_receives_unbound_events(): from langbot_plugin.api.entities.builtin.platform.events import MemberJoinedEvent bot = TestEventRouteTrace._make_bot([]) - bot.ap = SimpleNamespace(plugin_connector=SimpleNamespace(emit_event=AsyncMock())) + bot.ap = SimpleNamespace( + workspace_service=active_workspace_service(), + plugin_connector=SimpleNamespace(emit_event=AsyncMock()), + ) bot._record_adapter_event = AsyncMock() await bot._handle_platform_event(MemberJoinedEvent(), Mock()) bot.ap.plugin_connector.emit_event.assert_not_called() diff --git a/tests/unit_tests/provider/test_requester_base.py b/tests/unit_tests/provider/test_requester_base.py index 4ed1335fb..017c9e705 100644 --- a/tests/unit_tests/provider/test_requester_base.py +++ b/tests/unit_tests/provider/test_requester_base.py @@ -563,7 +563,7 @@ def test_requester_error_message_format(): """Test RequesterError message format.""" error = RequesterError('API returned 500') - assert '模型请求失败' in str(error) + assert 'Model request failed' in str(error) assert 'API returned 500' in str(error)