summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorFabio Menegazzo <fabio.menegazzo@axado.com.br>2016-09-28 14:57:56 -0300
committerFabio Menegazzo <fabio.menegazzo@axado.com.br>2016-10-05 08:14:56 -0300
commit0759c87dc38ab54cbb741d79bfb5bca656b622b7 (patch)
tree55a03da16b6899a6fd7b40b19922628a0dd45447 /tests/test_testing.py
parent702acf7858bd1fe7213b20df98a6970ac4814db7 (diff)
downloadclick-0759c87dc38ab54cbb741d79bfb5bca656b622b7.tar.gz
Add support to invoke args as string
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 7fc284a..c091095 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -202,3 +202,23 @@ def test_env():
assert result.output == 'ENV=some_value\n'
assert os.environ == env_orig
+
+
+@pytest.mark.parametrize('args, expected_output', [
+ (None, 'bar\n'),
+ ([], 'bar\n'),
+ ('', 'bar\n'),
+ (['--foo', 'one two'], 'one two\n'),
+ ('--foo "one two"', 'one two\n'),
+])
+def test_args(args, expected_output):
+
+ @click.command()
+ @click.option('--foo', default='bar')
+ def cli_args(foo):
+ click.echo(foo)
+
+ runner = CliRunner()
+ result = runner.invoke(cli_args, args=args)
+ assert result.exit_code == 0
+ assert result.output == expected_output