Esempio n. 1
0
def test_custom_command_with_int_arguments():
    def add(a: int, b: int) -> None:
        click.echo(str(a + b))

    app = App(commands=[add])
    runner = CommandLineRunner(app)

    result = runner.invoke([])
    assert 'add' in result.output

    result = runner.invoke(['add', '1', '2'])
    assert result.output == '3\n'
    assert result.exit_code == 0
Esempio n. 2
0
def test_custom_command_with_int_arguments():
    def add(a: int, b: int):
        click.echo(str(a + b))

    app = App(commands=[add])
    runner = CommandLineRunner(app)

    result = runner.invoke([])
    assert 'add' in result.output

    result = runner.invoke(['add', '1', '2'])
    assert result.output == '3\n'
    assert result.exit_code == 0
Esempio n. 3
0
def test_custom_command():
    def custom(var):
        click.echo(var)

    app = App(commands=[custom])
    runner = CommandLineRunner(app)

    result = runner.invoke([])
    assert 'custom' in result.output

    result = runner.invoke(['custom', '123'])
    assert result.output == '123\n'
    assert result.exit_code == 0
Esempio n. 4
0
def test_custom_command():
    def custom(var):
        click.echo(var)

    app = App(commands=[custom])
    runner = CommandLineRunner(app)

    result = runner.invoke([])
    assert 'custom' in result.output

    result = runner.invoke(['custom', '123'])
    assert result.output == '123\n'
    assert result.exit_code == 0