Skip to content
Myr

Added tests for prompts

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 15f0e22 · Browse files · 1 file+22 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−0 removed

  • tests:+22 added−0 removed

1 file+22 added−0 removed

modified:tests/test_testing.py+22 added
53 unmodified lines
54 runner = CliRunner(echo_stdin=True)55 result = runner.invoke(test, input=ReasonableBytesIO(b'Hello World!\n'))56 assert not result.exception57 assert result.output == 'Hello World!\nHello World!\n'585960def test_prompts():61 @click.command()62 @click.option('--foo', prompt=True)63 def test(foo):64 click.echo('foo=%s' % foo)6566 runner = CliRunner()67 result = runner.invoke(test, input='wau wau')68 assert not result.exception69 assert result.output == 'Foo: wau wau\nfoo=wau wau\n'7071 @click.command()72 @click.option('--foo', prompt=True, hide_input=True)73 def test(foo):74 click.echo('foo=%s' % foo)7576 runner = CliRunner()77 result = runner.invoke(test, input='wau wau')78 assert not result.exception79 assert result.output == 'Foo: \nfoo=wau wau\n'