summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-05-11 17:44:56 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2014-05-11 17:44:56 +0200
commitb3965e826d8aee3d8edc7788640229c10e2c2549 (patch)
tree78d405040bc85cb82281dbf3fb942408dc68863b /tests/test_testing.py
parent15f0e22383717b0373cd91fea0f2b4ef556e8358 (diff)
downloadclick-b3965e826d8aee3d8edc7788640229c10e2c2549.tar.gz
Added tests for prompts
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 3e11f61..933b426 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -55,3 +55,25 @@ def test_runner_with_stream():
result = runner.invoke(test, input=ReasonableBytesIO(b'Hello World!\n'))
assert not result.exception
assert result.output == 'Hello World!\nHello World!\n'
+
+
+def test_prompts():
+ @click.command()
+ @click.option('--foo', prompt=True)
+ def test(foo):
+ click.echo('foo=%s' % foo)
+
+ runner = CliRunner()
+ result = runner.invoke(test, input='wau wau')
+ assert not result.exception
+ assert result.output == 'Foo: wau wau\nfoo=wau wau\n'
+
+ @click.command()
+ @click.option('--foo', prompt=True, hide_input=True)
+ def test(foo):
+ click.echo('foo=%s' % foo)
+
+ runner = CliRunner()
+ result = runner.invoke(test, input='wau wau')
+ assert not result.exception
+ assert result.output == 'Foo: \nfoo=wau wau\n'