mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
test(discord): update reply_mode fixture for new to_reference() wrapping
Follow-up to the reply-reference fix: `_make_discord_adapter` used to return the raw fetched `Message` as the expected reference, but the adapter now wraps it via `ref_msg.to_reference(fail_if_not_exists=False)` so Discord treats a deleted target as 'send without reply chip'. Update the fixture to return the MessageReference sentinel so the 4 chunk-reference-identity tests assert against the right object. No production behavior change; only aligns the stale test fixture.
This commit is contained in:
parent
ef37aa7cce
commit
eabe14af1c
1 changed files with 9 additions and 2 deletions
|
|
@ -105,9 +105,14 @@ def _make_discord_adapter(reply_to_mode: str = "first"):
|
|||
config = PlatformConfig(enabled=True, token="test-token", reply_to_mode=reply_to_mode)
|
||||
adapter = DiscordAdapter(config)
|
||||
|
||||
# Mock the Discord client and channel
|
||||
# Mock the Discord client and channel.
|
||||
# ref_message.to_reference() → a distinct sentinel: the adapter now wraps
|
||||
# the fetched Message via to_reference(fail_if_not_exists=False) so a
|
||||
# deleted target degrades to "send without reply chip" instead of a 400.
|
||||
mock_channel = AsyncMock()
|
||||
ref_message = MagicMock()
|
||||
ref_reference = MagicMock(name="MessageReference")
|
||||
ref_message.to_reference = MagicMock(return_value=ref_reference)
|
||||
mock_channel.fetch_message = AsyncMock(return_value=ref_message)
|
||||
|
||||
sent_msg = MagicMock()
|
||||
|
|
@ -118,7 +123,9 @@ def _make_discord_adapter(reply_to_mode: str = "first"):
|
|||
mock_client.get_channel = MagicMock(return_value=mock_channel)
|
||||
|
||||
adapter._client = mock_client
|
||||
return adapter, mock_channel, ref_message
|
||||
# Return the reference sentinel alongside so tests can assert identity.
|
||||
adapter._test_expected_reference = ref_reference
|
||||
return adapter, mock_channel, ref_reference
|
||||
|
||||
|
||||
class TestSendWithReplyToMode:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue