From 616b1da3b59e5e74eab7b0384a84f143a99f455b Mon Sep 17 00:00:00 2001 From: Tora Kozic Date: Fri, 7 Oct 2022 10:07:22 -0500 Subject: [PATCH 1/4] chore/update-click-8.0 --- docs/requirements.txt | 2 +- setup.py | 2 +- tests/cmds/test_departing_employee.py | 7 +++++-- tests/cmds/test_securitydata.py | 7 +++++-- tests/cmds/test_trustedactivities.py | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 37ab4af69..4fffce759 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,2 @@ -click==7.1.2 +click==8.0.0 sphinx-click==2.5.0 diff --git a/setup.py b/setup.py index c123e5b6e..13aaa9d2a 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ python_requires=">=3.6.2, <4", install_requires=[ "chardet", - "click>=7.1.1, <8", + "click>=8.0.0, <8.1.0", "click_plugins>=1.1.1", "colorama>=0.4.3", "keyring==18.0.1", diff --git a/tests/cmds/test_departing_employee.py b/tests/cmds/test_departing_employee.py index feafddd64..a91378fd0 100644 --- a/tests/cmds/test_departing_employee.py +++ b/tests/cmds/test_departing_employee.py @@ -353,6 +353,7 @@ def test_remove_bulk_users_uses_expected_arguments_when_flat_file( def test_add_departing_employee_when_invalid_date_validation_raises_error( runner, cli_state_with_user ): + # day is out of range for month departure_date = "2020-02-30" result = runner.invoke( cli, @@ -367,7 +368,8 @@ def test_add_departing_employee_when_invalid_date_validation_raises_error( ) assert result.exit_code == 2 assert ( - "Invalid value for '--departure-date': invalid datetime format" in result.output + "Invalid value for '--departure-date': '2020-02-30' does not match the format '%Y-%m-%d'" + in result.output # invalid datetime format ) @@ -388,7 +390,8 @@ def test_add_departing_employee_when_invalid_date_format_validation_raises_error ) assert result.exit_code == 2 assert ( - "Invalid value for '--departure-date': invalid datetime format" in result.output + "Invalid value for '--departure-date': '2020-30-01' does not match the format '%Y-%m-%d'" + in result.output ) diff --git a/tests/cmds/test_securitydata.py b/tests/cmds/test_securitydata.py index b41e16fc9..8fd195618 100644 --- a/tests/cmds/test_securitydata.py +++ b/tests/cmds/test_securitydata.py @@ -326,7 +326,10 @@ def test_search_and_send_to_when_advanced_query_passed_non_existent_filename_rai cli, [*command, "--advanced-query", "@not_a_file"], obj=cli_state ) assert result.exit_code == 2 - assert "Could not open file: not_a_file" in result.stdout + assert ( + " Invalid value for '--advanced-query': 'not_a_file': No such file or directory" + in result.stdout + ) @search_and_send_to_test @@ -724,7 +727,7 @@ def test_search_and_send_to_when_given_invalid_exposure_type_causes_exit( obj=cli_state, ) assert result.exit_code == 2 - assert "invalid choice: NotValid" in result.output + assert "Invalid value" in result.output @search_and_send_to_test diff --git a/tests/cmds/test_trustedactivities.py b/tests/cmds/test_trustedactivities.py index df27af188..a835d3239 100644 --- a/tests/cmds/test_trustedactivities.py +++ b/tests/cmds/test_trustedactivities.py @@ -38,7 +38,7 @@ """ MISSING_ARGUMENT_ERROR = "Missing argument '{}'." -MISSING_TYPE = MISSING_ARGUMENT_ERROR.format("[DOMAIN|SLACK]") +MISSING_TYPE = MISSING_ARGUMENT_ERROR.format("{DOMAIN|SLACK}") MISSING_VALUE = MISSING_ARGUMENT_ERROR.format("VALUE") MISSING_RESOURCE_ID_ARG = MISSING_ARGUMENT_ERROR.format("RESOURCE_ID") RESOURCE_ID_NOT_FOUND_ERROR = "Resource ID '{}' not found." From 1015f76779bd2db4bce763fabddd555d38cf7463 Mon Sep 17 00:00:00 2001 From: Tora Kozic Date: Fri, 7 Oct 2022 13:03:58 -0500 Subject: [PATCH 2/4] remove click version upper limit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 13aaa9d2a..4a940e103 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ python_requires=">=3.6.2, <4", install_requires=[ "chardet", - "click>=8.0.0, <8.1.0", + "click>=8.0.0", "click_plugins>=1.1.1", "colorama>=0.4.3", "keyring==18.0.1", From 99b421963f5e5cd30fcdfcbd5aca275ad327553a Mon Sep 17 00:00:00 2001 From: Tora Kozic Date: Mon, 10 Oct 2022 14:10:09 -0500 Subject: [PATCH 3/4] test for both click <8 and >=8 error messages --- setup.py | 2 +- tests/cmds/test_departing_employee.py | 4 ++++ tests/cmds/test_securitydata.py | 6 ++++-- tests/cmds/test_trustedactivities.py | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 4a940e103..cdf146a04 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ python_requires=">=3.6.2, <4", install_requires=[ "chardet", - "click>=8.0.0", + "click>=7.1.1", "click_plugins>=1.1.1", "colorama>=0.4.3", "keyring==18.0.1", diff --git a/tests/cmds/test_departing_employee.py b/tests/cmds/test_departing_employee.py index a91378fd0..d682709b4 100644 --- a/tests/cmds/test_departing_employee.py +++ b/tests/cmds/test_departing_employee.py @@ -370,6 +370,8 @@ def test_add_departing_employee_when_invalid_date_validation_raises_error( assert ( "Invalid value for '--departure-date': '2020-02-30' does not match the format '%Y-%m-%d'" in result.output # invalid datetime format + ) or ( + "Invalid value for '--departure-date': invalid datetime format" in result.output ) @@ -392,6 +394,8 @@ def test_add_departing_employee_when_invalid_date_format_validation_raises_error assert ( "Invalid value for '--departure-date': '2020-30-01' does not match the format '%Y-%m-%d'" in result.output + ) or ( + "Invalid value for '--departure-date': invalid datetime format" in result.output ) diff --git a/tests/cmds/test_securitydata.py b/tests/cmds/test_securitydata.py index 8fd195618..a062be4d6 100644 --- a/tests/cmds/test_securitydata.py +++ b/tests/cmds/test_securitydata.py @@ -329,7 +329,7 @@ def test_search_and_send_to_when_advanced_query_passed_non_existent_filename_rai assert ( " Invalid value for '--advanced-query': 'not_a_file': No such file or directory" in result.stdout - ) + ) or ("Could not open file: not_a_file" in result.stdout) @search_and_send_to_test @@ -727,7 +727,9 @@ def test_search_and_send_to_when_given_invalid_exposure_type_causes_exit( obj=cli_state, ) assert result.exit_code == 2 - assert "Invalid value" in result.output + assert ( + "Invalid value" in result.output or "invalid choice: NotValid" in result.output + ) @search_and_send_to_test diff --git a/tests/cmds/test_trustedactivities.py b/tests/cmds/test_trustedactivities.py index a835d3239..4efe57666 100644 --- a/tests/cmds/test_trustedactivities.py +++ b/tests/cmds/test_trustedactivities.py @@ -114,7 +114,10 @@ def test_create_when_missing_type_prints_error(runner, cli_state): command = ["trusted-activities", "create", "--description", "description"] result = runner.invoke(cli, command, obj=cli_state) assert result.exit_code == 2 - assert MISSING_TYPE in result.output + assert ( + MISSING_TYPE in result.output + or MISSING_ARGUMENT_ERROR.format("[DOMAIN|SLACK]") in result.output + ) def test_create_when_missing_value_prints_error(runner, cli_state): From 561bd4d7ad570a4264f24d425751234798300a29 Mon Sep 17 00:00:00 2001 From: Tora Kozic Date: Mon, 10 Oct 2022 14:12:54 -0500 Subject: [PATCH 4/4] prep for release --- CHANGELOG.md | 6 ++++++ setup.py | 2 +- src/code42cli/__version__.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8e95d2d..c282d3adc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The intended audience of this file is for py42 consumers -- as such, changes that don't affect how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here. +## 1.16.1 - 2022-10-10 + +### Added + +- Support for `click` version `>=8.0.0`. + ## 1.16.0 - 2022-10-06 ### Added diff --git a/setup.py b/setup.py index cdf146a04..362119d11 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ python_requires=">=3.6.2, <4", install_requires=[ "chardet", - "click>=7.1.1", + "click==7.1.1", "click_plugins>=1.1.1", "colorama>=0.4.3", "keyring==18.0.1", diff --git a/src/code42cli/__version__.py b/src/code42cli/__version__.py index 638c1217d..d38802290 100644 --- a/src/code42cli/__version__.py +++ b/src/code42cli/__version__.py @@ -1 +1 @@ -__version__ = "1.16.0" +__version__ = "1.16.1"