beatbot-cloud 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {beatbot_cloud-0.4.2/src/beatbot_cloud.egg-info → beatbot_cloud-0.4.3}/PKG-INFO +1 -1
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/pyproject.toml +1 -1
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/client.py +5 -1
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3/src/beatbot_cloud.egg-info}/PKG-INFO +1 -1
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/tests/test_client.py +22 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/LICENSE +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/README.md +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/setup.cfg +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/__init__.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/auth.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/const.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/event_client.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/exceptions.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/models.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/protocol.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/py.typed +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud/websocket.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud.egg-info/SOURCES.txt +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud.egg-info/dependency_links.txt +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud.egg-info/requires.txt +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/src/beatbot_cloud.egg-info/top_level.txt +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/tests/test_auth.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/tests/test_event_client.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/tests/test_protocol.py +0 -0
- {beatbot_cloud-0.4.2 → beatbot_cloud-0.4.3}/tests/test_websocket.py +0 -0
|
@@ -92,7 +92,11 @@ class BeatbotClient:
|
|
|
92
92
|
except (TimeoutError, ClientError) as err:
|
|
93
93
|
raise BeatbotConnectionError(str(err)) from err
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
try:
|
|
96
|
+
body = await response.text()
|
|
97
|
+
except (TimeoutError, ClientError) as err:
|
|
98
|
+
raise BeatbotConnectionError(str(err)) from err
|
|
99
|
+
|
|
96
100
|
if response.status in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN):
|
|
97
101
|
raise BeatbotAuthenticationError(f"Unauthorized: {response.status}")
|
|
98
102
|
if response.status >= HTTPStatus.BAD_REQUEST:
|
|
@@ -122,6 +122,28 @@ async def test_timeout_is_connection_error():
|
|
|
122
122
|
await api._request("GET", "/test")
|
|
123
123
|
|
|
124
124
|
|
|
125
|
+
@pytest.mark.parametrize(
|
|
126
|
+
("error", "message"),
|
|
127
|
+
[
|
|
128
|
+
(ClientError("body read failed"), "body read failed"),
|
|
129
|
+
(TimeoutError("body read timed out"), "body read timed out"),
|
|
130
|
+
],
|
|
131
|
+
ids=["client-error", "timeout"],
|
|
132
|
+
)
|
|
133
|
+
async def test_body_read_error_is_connection_error(error, message):
|
|
134
|
+
"""Reading the response body cannot escape as a raw aiohttp error."""
|
|
135
|
+
response = Response("{}")
|
|
136
|
+
|
|
137
|
+
async def failing_text():
|
|
138
|
+
raise error
|
|
139
|
+
|
|
140
|
+
response.text = failing_text
|
|
141
|
+
api, _ = client(response)
|
|
142
|
+
|
|
143
|
+
with pytest.raises(BeatbotConnectionError, match=message):
|
|
144
|
+
await api._request("GET", "/test")
|
|
145
|
+
|
|
146
|
+
|
|
125
147
|
async def test_async_access_token_provider():
|
|
126
148
|
async def access_token():
|
|
127
149
|
return "rotated-token"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|