示例#1
0
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 == []
示例#2
0
def test_add_valid_command_valid():
    """It should add valid commands."""
    command_item = {
        "trigger": "/test",
        "command_description": "the test works!"
    }
    test_help_command = HelpCommand()
    test_help_command.add_valid_command(command_item)
    assert test_help_command.commands == ["*test*\nthe test works!\n\n"]
示例#3
0
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 == []
示例#4
0
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"