mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-19 06:10:07 +08:00
* fix(bridge): keep team member streams alive through refresh Cloud rooms dropped member tokens after the host turn ended, and a refresh mid-answer had nothing in history to restore. Hold the room subscriber and replay the in-progress member text when a client subscribes again. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: note cloud team stream refresh in the changelog Co-authored-by: Cursor <cursoragent@cursor.com> * fix(bridge): keep local login when peer credentials are rejected Peer auth failure used HTTP 401, so probing cloud collab cleared the local session and showed Unauthorized. Fixes #2166 Co-authored-by: Cursor <cursoragent@cursor.com> * feat(dashboard): split chat nav into experts, teams, and cloud Empty team and cloud lists can jump to create the first one, the host wrap-up lines up with the host avatar, and the cloud collab page explains how to connect. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(dashboard): add knowledge-base folder tree and unify list-panel rail toggles - Knowledge bases: add a resizable folder navigation tree beside the document list; move the breadcrumb into the docs toolbar and surface base id plus creator on list rows. - Knowledge bases / skill packages: move the collapse control onto the split divider as a hover pill and drop the separate detail header. - RailEdgeControl: pill button with center/before/after placement so two rails can share one divider. --------- Co-authored-by: jubaoliang <jubaoliang@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""tests/unit/test_errors.py"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from octop.infra.errors import ErrorCode, OctopError
|
|
|
|
|
|
def test_octop_error_carries_code_and_status():
|
|
err = OctopError(ErrorCode.AGENT_NOT_FOUND, "missing", details={"id": "a"})
|
|
assert err.code is ErrorCode.AGENT_NOT_FOUND
|
|
assert err.status == 404
|
|
assert err.message == "missing"
|
|
assert err.details == {"id": "a"}
|
|
|
|
|
|
def test_octop_error_default_status_for_known_code():
|
|
err = OctopError(ErrorCode.FORBIDDEN, "nope")
|
|
assert err.status == 403
|
|
|
|
|
|
def test_bridge_auth_failed_is_not_http_401():
|
|
"""Peer login failure must not share the local-session 401 status."""
|
|
err = OctopError(ErrorCode.BRIDGE_AUTH_FAILED, "peer rejected credentials")
|
|
assert err.status == 400
|
|
|
|
|
|
def test_octop_error_to_envelope():
|
|
err = OctopError(ErrorCode.AUTH_FAILED, "bad creds")
|
|
assert err.to_envelope() == {
|
|
"error": {"code": "AUTH_FAILED", "message": "bad creds", "details": {}}
|
|
}
|
|
|
|
|
|
def test_octop_error_to_envelope_localized():
|
|
err = OctopError(ErrorCode.TOKEN_EXPIRED, "token expired")
|
|
assert err.to_envelope(locale="zh")["error"]["message"] == "登录已过期,请重新登录。"
|
|
|
|
|
|
def test_unknown_error_code_rejected():
|
|
with pytest.raises(ValueError):
|
|
ErrorCode("NOT_A_CODE")
|