import pytest from myfasthtml.core.commands import Command, CommandsManager def callback(): return "Hello World" @pytest.fixture(autouse=True) def test_reset_command_manager(): CommandsManager.reset() def test_i_can_create_a_command_with_no_params(): command = Command('test', 'Command description', callback) assert command.id is not None assert command.name == 'test' assert command.description == 'Command description' assert command.execute() == "Hello World" def test_command_are_registered(): command = Command('test', 'Command description', callback) assert CommandsManager.commands.get(str(command.id)) is command