Skip to content

Commit

Permalink
test: End to end tests for input values from #403, #404, #405 and #406
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Feb 9, 2020
1 parent 1418a20 commit e16d817
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/cli/test_commands.py
Expand Up @@ -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',
Expand All @@ -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)',
Expand All @@ -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. '
Expand All @@ -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):
Expand Down

0 comments on commit e16d817

Please sign in to comment.