The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(qqbot): add approval auth test for dm session keys
penginmane0a6a43b2b9f
diff --git a/tests/gateway/test_qqbot.py b/tests/gateway/test_qqbot.pyindex 5473c7a4b2e..5e7b47a59b2 100644--- a/tests/gateway/test_qqbot.py+++ b/tests/gateway/test_qqbot.py@@ -955,6 +955,33 @@ class TestDefaultInteractionDispatch:assert resolve_calls == []+ @pytest.mark.asyncio+ async def test_approval_click_dm_session_authorizes_owner(self):+ """dm-typed session key with matching operator should be authorized."""+ adapter = self._make_adapter()+ resolve_calls = []++ def fake_resolve(session_key, choice, resolve_all=False):+ resolve_calls.append((session_key, choice, resolve_all))+ return 1++ import tools.approval+ orig = tools.approval.resolve_gateway_approval+ tools.approval.resolve_gateway_approval = fake_resolve+ try:+ from gateway.platforms.qqbot.keyboards import parse_interaction_event+ event = parse_interaction_event({+ "id": "i",+ "chat_type": 2,+ "user_openid": "u-42",+ "data": {"resolved": {"button_data": "approve:agent:main:qqbot:dm:u-42:allow-once"}},+ })+ await adapter._default_interaction_dispatch(event)+ finally:+ tools.approval.resolve_gateway_approval = orig++ assert resolve_calls == [("agent:main:qqbot:dm:u-42", "once", False)]+@pytest.mark.asyncioasync def test_update_prompt_click_writes_response_file(self, tmp_path, monkeypatch):"""update_prompt:y click writes 'y' to ~/.hermes/.update_response."""