From d1047855b419309498baaec6db47d5489052f1f5 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Mon, 21 Oct 2024 18:39:06 -0500 Subject: [PATCH] Fix minor TODOs (#1044) There were two distinct items, one of which applies twice: - a `responses` compatibility tweak - an SDK exception property being added (x2) --- src/globus_cli/exception_handling/hooks.py | 6 ++---- tests/conftest.py | 11 +++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/globus_cli/exception_handling/hooks.py b/src/globus_cli/exception_handling/hooks.py index 8a87c3312..5217d270c 100644 --- a/src/globus_cli/exception_handling/hooks.py +++ b/src/globus_cli/exception_handling/hooks.py @@ -272,8 +272,7 @@ def transferapi_hook(exception: globus_sdk.TransferAPIError) -> None: def searchapi_validationerror_hook(exception: globus_sdk.SearchAPIError) -> None: fields = [ PrintableErrorField("HTTP status", exception.http_status), - # FIXME: raw_json because SDK is not exposing `request_id` as an attribute - PrintableErrorField("request_id", (exception.raw_json or {}).get("request_id")), + PrintableErrorField("request_id", exception.request_id), PrintableErrorField("code", exception.code), PrintableErrorField("message", exception.message, multiline=True), ] @@ -298,8 +297,7 @@ def searchapi_validationerror_hook(exception: globus_sdk.SearchAPIError) -> None def searchapi_hook(exception: globus_sdk.SearchAPIError) -> None: fields = [ PrintableErrorField("HTTP status", exception.http_status), - # FIXME: raw_json because SDK is not exposing `request_id` as an attribute - PrintableErrorField("request_id", (exception.raw_json or {}).get("request_id")), + PrintableErrorField("request_id", exception.request_id), PrintableErrorField("code", exception.code), PrintableErrorField("message", exception.message, multiline=True), ] diff --git a/tests/conftest.py b/tests/conftest.py index 30ec9ee23..2adf04bda 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -355,15 +355,10 @@ def do_register(filename): for idx, (path, method, params) in enumerate(_iter_fixture_routes(routes)): if "query_params" in params: - # TODO: remove this int/float conversion after we upgrade to - # `responses>=0.19.0` when this issue is expected to be fixed - # https://github.com/getsentry/responses/pull/485 - query_params = { - k: str(v) if isinstance(v, (int, float)) else v - for k, v in params.pop("query_params").items() - } params["match"] = [ - responses.matchers.query_param_matcher(query_params) + responses.matchers.query_param_matcher( + params.pop("query_params") + ) ] response_set[f"{method}_{service}_{path}_{idx}"] = { "service": service,