def test_addValidCommand_invalid_empty(): """It should not add commands which have no trigger.""" command_item = {"/help": "test", "command_description": "the test works!"} test_help_command = HelpCommand() test_help_command.commands = [] test_help_command.add_valid_command(command_item) assert test_help_command.commands == []
def test_add_valid_command_invalid_slash(): """It should not add commands which have a trigger not starting with '/'.""" command_item = { "trigger": "test", "command_description": "the test works!" } test_help_command = HelpCommand() test_help_command.commands = [] test_help_command.add_valid_command(command_item) assert test_help_command.commands == []
def test_parse_command_item(): """It should parse correctly a command item.""" command_item = { "trigger": "/test", "command_description": "the test works!" } test_help_command = HelpCommand() test_help_command.commands = [] test_help_command.add_valid_command(command_item) result = test_help_command.commands[0] assert result == "*test*\nthe test works!\n\n"