Skip to content

Commit 99b4219

Browse files
committed
test for both click <8 and >=8 error messages
1 parent 1015f76 commit 99b4219

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
python_requires=">=3.6.2, <4",
3333
install_requires=[
3434
"chardet",
35-
"click>=8.0.0",
35+
"click>=7.1.1",
3636
"click_plugins>=1.1.1",
3737
"colorama>=0.4.3",
3838
"keyring==18.0.1",

tests/cmds/test_departing_employee.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ def test_add_departing_employee_when_invalid_date_validation_raises_error(
370370
assert (
371371
"Invalid value for '--departure-date': '2020-02-30' does not match the format '%Y-%m-%d'"
372372
in result.output # invalid datetime format
373+
) or (
374+
"Invalid value for '--departure-date': invalid datetime format" in result.output
373375
)
374376

375377

@@ -392,6 +394,8 @@ def test_add_departing_employee_when_invalid_date_format_validation_raises_error
392394
assert (
393395
"Invalid value for '--departure-date': '2020-30-01' does not match the format '%Y-%m-%d'"
394396
in result.output
397+
) or (
398+
"Invalid value for '--departure-date': invalid datetime format" in result.output
395399
)
396400

397401

tests/cmds/test_securitydata.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_search_and_send_to_when_advanced_query_passed_non_existent_filename_rai
329329
assert (
330330
" Invalid value for '--advanced-query': 'not_a_file': No such file or directory"
331331
in result.stdout
332-
)
332+
) or ("Could not open file: not_a_file" in result.stdout)
333333

334334

335335
@search_and_send_to_test
@@ -727,7 +727,9 @@ def test_search_and_send_to_when_given_invalid_exposure_type_causes_exit(
727727
obj=cli_state,
728728
)
729729
assert result.exit_code == 2
730-
assert "Invalid value" in result.output
730+
assert (
731+
"Invalid value" in result.output or "invalid choice: NotValid" in result.output
732+
)
731733

732734

733735
@search_and_send_to_test

tests/cmds/test_trustedactivities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ def test_create_when_missing_type_prints_error(runner, cli_state):
114114
command = ["trusted-activities", "create", "--description", "description"]
115115
result = runner.invoke(cli, command, obj=cli_state)
116116
assert result.exit_code == 2
117-
assert MISSING_TYPE in result.output
117+
assert (
118+
MISSING_TYPE in result.output
119+
or MISSING_ARGUMENT_ERROR.format("[DOMAIN|SLACK]") in result.output
120+
)
118121

119122

120123
def test_create_when_missing_value_prints_error(runner, cli_state):

0 commit comments

Comments
 (0)