From e16d817e4e1b6d9f91cf876ee1d27bd8189f9e9c Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Sat, 8 Feb 2020 22:23:41 +0100 Subject: [PATCH] test: End to end tests for input values from #403, #404, #405 and #406 --- test/cli/test_commands.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/cli/test_commands.py b/test/cli/test_commands.py index 87cfa88dac..dc6353d608 100644 --- a/test/cli/test_commands.py +++ b/test/cli/test_commands.py @@ -59,6 +59,10 @@ def test_commands_version(cli): (("run", SIMPLE_PATH), 'Error: Missing argument, "--base-url" is required for SCHEMA specified by file.'), (("run", SIMPLE_PATH, "--base-url=test"), "Error: Invalid base URL"), (("run", SIMPLE_PATH, "--base-url=127.0.0.1:8080"), "Error: Invalid base URL"), + ( + ("run", "http://127.0.0.1", "--method=+"), + 'Error: Invalid value for "--method" / "-M": Invalid regex: nothing to repeat at position 0', + ), ( ("run", "http://127.0.0.1", "--auth=123"), 'Error: Invalid value for "--auth" / "-a": Should be in KEY:VALUE format. Got: 123', @@ -67,6 +71,14 @@ def test_commands_version(cli): ("run", "http://127.0.0.1", "--auth=:pass"), 'Error: Invalid value for "--auth" / "-a": Username should not be empty', ), + ( + ("run", "http://127.0.0.1", "--auth=тест:pass"), + 'Error: Invalid value for "--auth" / "-a": Username should be latin-1 encodable', + ), + ( + ("run", "http://127.0.0.1", "--auth=user:тест"), + 'Error: Invalid value for "--auth" / "-a": Password should be latin-1 encodable', + ), ( ("run", "http://127.0.0.1", "--auth-type=random"), 'Error: Invalid value for "--auth-type" / "-A": invalid choice: random. (choose from basic, digest)', @@ -79,6 +91,10 @@ def test_commands_version(cli): ("run", "http://127.0.0.1", "--header=:"), 'Error: Invalid value for "--header" / "-H": Header name should not be empty', ), + ( + ("run", "http://127.0.0.1", "--header= :"), + 'Error: Invalid value for "--header" / "-H": Header name should not be empty', + ), ( ("run", "http://127.0.0.1", "--hypothesis-phases=explicit,first,second"), 'Error: Invalid value for "--hypothesis-phases": invalid choice(s): first, second. ' @@ -88,6 +104,15 @@ def test_commands_version(cli): ("run", "http://127.0.0.1", "--hypothesis-deadline=wrong"), 'Error: Invalid value for "--hypothesis-deadline": wrong is not a valid integer or None', ), + ( + ("run", "http://127.0.0.1", "--header=тест:test"), + 'Error: Invalid value for "--header" / "-H": Header name should be latin-1 encodable', + ), + ( + ("run", "http://127.0.0.1", "--header=test:тест"), + 'Error: Invalid value for "--header" / "-H": Header value should be latin-1 encodable', + ), + (("run", "//test",), "Error: Invalid SCHEMA, must be a valid URL or file path."), ), ) def test_commands_run_errors(cli, args, error):