mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-04-25 16:52:06 +00:00
Command tests: - tests/commands/: test_base_command, test_cmd_command, test_dice_command, test_hello_command, test_help_command, test_magic8_command, test_ping_command, test_roll_command - tests/test_bridge_bot_responses, test_channel_manager_logic, test_checkin_service, test_command_manager, test_command_prefix, test_config_merge, test_config_validation, test_db_manager, test_plugin_loader, test_profanity_filter, test_security_utils, test_service_plugin_loader, test_utils Integration and unit: - tests/integration/: test_path_graph_integration, test_path_resolution - tests/regression/: test_keyword_escapes - tests/unit/: test_mesh_graph, test_mesh_graph_edges, test_mesh_graph_multihop, test_mesh_graph_optimizations, test_mesh_graph_scoring, test_mesh_graph_validation, test_path_command_graph, test_path_command_graph_selection, test_path_command_multibyte Helpers: tests/conftest.py, tests/helpers.py
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""Tests for modules.commands.help_command."""
|
|
|
|
import pytest
|
|
|
|
from modules.commands.help_command import HelpCommand
|
|
from tests.conftest import mock_message
|
|
|
|
|
|
class TestHelpCommand:
|
|
"""Tests for HelpCommand."""
|
|
|
|
def test_can_execute_when_enabled(self, command_mock_bot):
|
|
command_mock_bot.config.add_section("Help_Command")
|
|
command_mock_bot.config.set("Help_Command", "enabled", "true")
|
|
cmd = HelpCommand(command_mock_bot)
|
|
msg = mock_message(content="help", is_dm=True)
|
|
assert cmd.can_execute(msg) is True
|
|
|
|
def test_can_execute_when_disabled(self, command_mock_bot):
|
|
command_mock_bot.config.add_section("Help_Command")
|
|
command_mock_bot.config.set("Help_Command", "enabled", "false")
|
|
cmd = HelpCommand(command_mock_bot)
|
|
msg = mock_message(content="help", is_dm=True)
|
|
assert cmd.can_execute(msg) is False
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_execute_returns_true(self, command_mock_bot):
|
|
command_mock_bot.config.add_section("Help_Command")
|
|
command_mock_bot.config.set("Help_Command", "enabled", "true")
|
|
cmd = HelpCommand(command_mock_bot)
|
|
msg = mock_message(content="help", is_dm=True)
|
|
result = await cmd.execute(msg)
|
|
assert result is True
|
|
# Note: HelpCommand.execute() is a placeholder; actual help logic is in
|
|
# CommandManager.check_keywords(). Response sending is tested there.
|