Skip to content

Commit

Permalink
Fix minor TODOs (#1044)
Browse files Browse the repository at this point in the history
There were two distinct items, one of which applies twice:
- a `responses` compatibility tweak
- an SDK exception property being added (x2)
  • Loading branch information
sirosen authored Oct 21, 2024
1 parent c5d3b78 commit d104785
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/globus_cli/exception_handling/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
Expand All @@ -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),
]
Expand Down
11 changes: 3 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d104785

Please sign in to comment.