v10.1.2: Fix exception handling for HTTP 4XX responses

This commit is contained in:
Administrator 2023-04-14 23:02:04 +00:00
parent 65cdc9ada7
commit 1b71618d31
4 changed files with 10 additions and 3 deletions

View File

@ -11,11 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
- Nothing yet.
## [10.1.2]
## Fixed ## Fixed
- HTTP 4XX errors now raise a `SporeStackUserError` instead of `SporeStackServerError`. - HTTP 4XX errors now raise a `SporeStackUserError` instead of `SporeStackServerError`.
## [10.2.0 - 2023-04-14] ## [10.1.1 - 2023-04-14]
## Added ## Added

View File

@ -2,4 +2,4 @@
__all__ = ["api", "api_client", "exceptions"] __all__ = ["api", "api_client", "exceptions"]
__version__ = "10.1.1" __version__ = "10.1.2"

View File

@ -3,6 +3,8 @@ import pytest
import respx import respx
from sporestack import api_client, exceptions from sporestack import api_client, exceptions
# respx seems to ignore the uri://domain if you don't specify it.
def test__is_onion_url() -> None: def test__is_onion_url() -> None:
onion_url = "http://spore64i5sofqlfz5gq2ju4msgzojjwifls7" onion_url = "http://spore64i5sofqlfz5gq2ju4msgzojjwifls7"
@ -85,7 +87,7 @@ def test_token_info(respx_mock: respx.MockRouter) -> None:
"days_remaining": 0, "days_remaining": 0,
} }
route_response = httpx.Response(200, json=response_json) route_response = httpx.Response(200, json=response_json)
route = respx_mock.get(f"https://api.sporestack.com/token/{dummy_token}/info").mock( route = respx_mock.get(f"/token/{dummy_token}/info").mock(
return_value=route_response return_value=route_response
) )

View File

@ -12,6 +12,7 @@ deps =
pytest-socket~=0.6.0 pytest-socket~=0.6.0
pytest-cov~=4.0 pytest-cov~=4.0
pytest-mock~=3.6 pytest-mock~=3.6
respx~=0.20.1
commands = commands =
pytest --cov=sporestack --cov-fail-under=39 --cov-report=term --durations=3 pytest --cov=sporestack --cov-fail-under=39 --cov-report=term --durations=3
sporestack api-endpoint sporestack api-endpoint