Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Transform isair/jarvis into a Discord-controlled voice assistant running on the Ubuntu VNC desktop, keeping the mature ~39k-line Python brain intact. - bot/ (Node + bun, discord.js): /자비스 slash commands (ephemeral), voice channel join + voice receive/playback, pluggable VNC screen broadcast (selfbot live / noVNC / screenshot) - bridge/ (Python, Flask): wraps jarvis STT + run_reply_engine + Piper TTS behind a thin localhost HTTP API - .env.example, scripts/ (start_bridge/start_bot/dev), README rewrite, docs/language-comparison.md and docs/vnc-xfce-setup.md Language decision: hybrid (Python brain + Node/bun Discord layer) because Discord blocks bot video; native screen broadcast only works via a Node selfbot library.
60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
"""Tests for delete meal tool."""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock
|
|
|
|
from src.jarvis.tools.builtin.nutrition.delete_meal import DeleteMealTool
|
|
from src.jarvis.tools.base import ToolContext
|
|
from src.jarvis.tools.types import ToolExecutionResult
|
|
|
|
|
|
class TestDeleteMealTool:
|
|
"""Test delete meal tool functionality."""
|
|
|
|
def setup_method(self):
|
|
"""Set up test fixtures."""
|
|
self.tool = DeleteMealTool()
|
|
self.context = Mock(spec=ToolContext)
|
|
self.context.user_print = Mock()
|
|
self.context.db = Mock()
|
|
|
|
def test_tool_properties(self):
|
|
"""Test tool metadata properties."""
|
|
assert self.tool.name == "deleteMeal"
|
|
assert "delete" in self.tool.description.lower()
|
|
assert self.tool.inputSchema["type"] == "object"
|
|
assert "id" in self.tool.inputSchema["required"]
|
|
|
|
def test_run_success(self):
|
|
"""Test successful meal deletion."""
|
|
self.context.db.delete_meal.return_value = True
|
|
|
|
args = {"id": 123}
|
|
result = self.tool.run(args, self.context)
|
|
|
|
assert isinstance(result, ToolExecutionResult)
|
|
assert result.success is True
|
|
assert "Meal deleted" in result.reply_text
|
|
self.context.db.delete_meal.assert_called_once_with(123)
|
|
|
|
def test_run_failure(self):
|
|
"""Test meal deletion failure."""
|
|
self.context.db.delete_meal.return_value = False
|
|
|
|
args = {"id": 999}
|
|
result = self.tool.run(args, self.context)
|
|
|
|
assert isinstance(result, ToolExecutionResult)
|
|
assert result.success is False
|
|
assert "couldn't delete" in result.reply_text.lower()
|
|
|
|
def test_run_invalid_id(self):
|
|
"""Test deletion with invalid ID."""
|
|
args = {"id": "not_a_number"}
|
|
result = self.tool.run(args, self.context)
|
|
|
|
assert isinstance(result, ToolExecutionResult)
|
|
assert result.success is False
|
|
# Should not call db.delete_meal with invalid ID
|
|
self.context.db.delete_meal.assert_not_called()
|