Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Ownership tests for desktop message reactions."""
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from tools import react_to_message_tool as reactions
|
||||
|
||||
|
||||
def test_reaction_database_closes_when_write_fails(monkeypatch):
|
||||
db = MagicMock()
|
||||
db.latest_message_row_id.return_value = 42
|
||||
db.set_message_reaction.side_effect = RuntimeError("write failed")
|
||||
monkeypatch.setattr(reactions, "_open_session_db", lambda: db)
|
||||
monkeypatch.setattr(
|
||||
reactions,
|
||||
"get_session_env",
|
||||
lambda _name, _default="": "session-1",
|
||||
)
|
||||
|
||||
result = reactions.react_to_message_tool("👍")
|
||||
|
||||
assert "write failed" in result
|
||||
db.close.assert_called_once()
|
||||
Reference in New Issue
Block a user