fix: 对齐 test_account 在 404 响应下的日志成功标志及错误类型口径,与标准接口行为一致
This commit is contained in:
@@ -380,6 +380,8 @@ class Sub2ApiWebsiteClient:
|
|||||||
with self._client.stream("POST", url, headers=headers) as response:
|
with self._client.stream("POST", url, headers=headers) as response:
|
||||||
status_code = response.status_code
|
status_code = response.status_code
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
|
error_type = "HTTPStatus"
|
||||||
|
error_msg = "HTTP 404"
|
||||||
return {"status": "404", "cleanup_allowed": True, "message": "账号在远端不存在 (404)"}
|
return {"status": "404", "cleanup_allowed": True, "message": "账号在远端不存在 (404)"}
|
||||||
if response.status_code >= 400:
|
if response.status_code >= 400:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ def test_website_client_test_account_sse_scenarios(monkeypatch):
|
|||||||
assert res["cleanup_allowed"] is True
|
assert res["cleanup_allowed"] is True
|
||||||
assert len(log_calls) == 3
|
assert len(log_calls) == 3
|
||||||
assert log_calls[-1]["status_code"] == 404
|
assert log_calls[-1]["status_code"] == 404
|
||||||
assert log_calls[-1]["success"] is True
|
assert log_calls[-1]["success"] is False
|
||||||
|
assert log_calls[-1]["error_type"] == "HTTPStatus"
|
||||||
|
assert log_calls[-1]["error_message"] == "HTTP 404"
|
||||||
|
|
||||||
# 4. error event
|
# 4. error event
|
||||||
monkeypatch.setattr(c._client, "stream", mock_stream(200, ["event: error", "data: \"internal error\""]))
|
monkeypatch.setattr(c._client, "stream", mock_stream(200, ["event: error", "data: \"internal error\""]))
|
||||||
|
|||||||
Reference in New Issue
Block a user