Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/bot/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,11 +1385,11 @@ def _handle_gif_command(


def _handle_tasks_command(
deps: Any = None,
*,
command: str,
chat_id: str,
handler_func: Callable[..., str | Tuple[str, Optional[Dict[str, Any]]]],
deps: Any = None,
message: Any = None,
billing_helper: Any = None,
redis_client: Any = None,
Expand Down
43 changes: 43 additions & 0 deletions tests/test_message_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,49 @@ def test_handle_non_ai_command_passes_world_cup_country_query():
handler.assert_called_once_with(timezone_offset=-3, team_query="argentina")


def test_handle_non_ai_command_tasks_command():
from api.bot.message_handler import (
CommandDispatchContext,
PreparedMessage,
_handle_non_ai_command,
)

handler = MagicMock(return_value=("lista de tareas", {"inline_keyboard": []}))
commands = {
"/tasks": (handler, False, False),
"/tareas": (handler, False, False),
}

deps = MagicMock()
for cmd in ("/tasks", "/tareas"):
response = _handle_non_ai_command(
deps,
CommandDispatchContext(
commands=commands,
command=cmd,
sanitized_message_text="",
message={"message_id": "10"},
chat_id="123",
chat_type="private",
user_id=7,
numeric_chat_id=123,
prepared_message=PreparedMessage(
message_text=cmd,
photo_file_id=None,
audio_file_id=None,
),
billing_helper=MagicMock(),
reply_context_text=None,
user_identity="Ana (ana)",
redis_client=MagicMock(),
timezone_offset=-3,
),
)

assert response == ("lista de tareas", {"inline_keyboard": []}, False, cmd)
handler.assert_called_with("123")


def test_message_handler_routes_ai_command_through_known_command_path(monkeypatch):
from api.bot.message_handler import handle_msg

Expand Down