rename popup chat to floating chat
This commit is contained in:
@@ -6,9 +6,9 @@ from pydantic import ValidationError
|
||||
from app.schemas import (
|
||||
WsFrameType,
|
||||
WsHomeRequest,
|
||||
WsPopupDomain,
|
||||
WsPopupRequest,
|
||||
WsPopupScope,
|
||||
WsFloatingDomain,
|
||||
WsFloatingRequest,
|
||||
WsFloatingScope,
|
||||
WsStreamBlock,
|
||||
WsStreamEnd,
|
||||
WsStreamStart,
|
||||
@@ -22,12 +22,12 @@ from app.schemas import (
|
||||
def test_v3_frame_types_exist():
|
||||
v3_types = [
|
||||
"home_request",
|
||||
"popup_request",
|
||||
"floating_request",
|
||||
"stream_start",
|
||||
"stream_text",
|
||||
"stream_block",
|
||||
"stream_end",
|
||||
"popup_domain",
|
||||
"floating_domain",
|
||||
"data_request",
|
||||
"data_response",
|
||||
"mutation",
|
||||
@@ -90,49 +90,49 @@ def test_home_request_requires_message():
|
||||
WsHomeRequest.model_validate({"type": "home_request"})
|
||||
|
||||
|
||||
# ── WsPopupRequest ────────────────────────────────────────────────────
|
||||
# ── WsFloatingRequest ────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_popup_request_basic():
|
||||
frame = WsPopupRequest(
|
||||
def test_floating_request_basic():
|
||||
frame = WsFloatingRequest(
|
||||
message="Summarise",
|
||||
scope=WsPopupScope(type="task", id="task-123"),
|
||||
scope=WsFloatingScope(type="task", id="task-123"),
|
||||
)
|
||||
assert frame.type == WsFrameType.popup_request
|
||||
assert frame.type == WsFrameType.floating_request
|
||||
assert frame.scope.type == "task"
|
||||
assert frame.scope.id == "task-123"
|
||||
|
||||
|
||||
def test_popup_request_scope_without_id():
|
||||
frame = WsPopupRequest(
|
||||
def test_floating_request_scope_without_id():
|
||||
frame = WsFloatingRequest(
|
||||
message="Show all",
|
||||
scope=WsPopupScope(type="project"),
|
||||
scope=WsFloatingScope(type="project"),
|
||||
)
|
||||
assert frame.scope.id is None
|
||||
|
||||
|
||||
def test_popup_request_serializes():
|
||||
frame = WsPopupRequest(
|
||||
def test_floating_request_serializes():
|
||||
frame = WsFloatingRequest(
|
||||
message="Test",
|
||||
scope=WsPopupScope(type="note", id="n-1"),
|
||||
scope=WsFloatingScope(type="note", id="n-1"),
|
||||
)
|
||||
data = frame.model_dump()
|
||||
assert data["type"] == "popup_request"
|
||||
assert data["type"] == "floating_request"
|
||||
assert data["scope"]["type"] == "note"
|
||||
assert data["scope"]["id"] == "n-1"
|
||||
|
||||
|
||||
def test_popup_request_invalid_scope_type():
|
||||
def test_floating_request_invalid_scope_type():
|
||||
with pytest.raises(ValidationError):
|
||||
WsPopupRequest(
|
||||
WsFloatingRequest(
|
||||
message="X",
|
||||
scope=WsPopupScope(type="unknown"), # type: ignore[arg-type]
|
||||
scope=WsFloatingScope(type="unknown"), # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
|
||||
def test_popup_request_requires_scope():
|
||||
def test_floating_request_requires_scope():
|
||||
with pytest.raises(ValidationError):
|
||||
WsPopupRequest.model_validate({"type": "popup_request", "message": "X"})
|
||||
WsFloatingRequest.model_validate({"type": "floating_request", "message": "X"})
|
||||
|
||||
|
||||
# ── WsStreamStart ─────────────────────────────────────────────────────
|
||||
@@ -261,32 +261,32 @@ def test_stream_end_deserializes():
|
||||
assert frame.request_id == "r3"
|
||||
|
||||
|
||||
# ── WsPopupDomain ─────────────────────────────────────────────────────
|
||||
# ── WsFloatingDomain ─────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_popup_domain_tasks():
|
||||
frame = WsPopupDomain(request_id="r1", domain="tasks")
|
||||
assert frame.type == WsFrameType.popup_domain
|
||||
def test_floating_domain_tasks():
|
||||
frame = WsFloatingDomain(request_id="r1", domain="tasks")
|
||||
assert frame.type == WsFrameType.floating_domain
|
||||
assert frame.domain == "tasks"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("domain", ["tasks", "checkpoints", "notes", "projects"])
|
||||
def test_popup_domain_valid_domains(domain: str):
|
||||
frame = WsPopupDomain(request_id="r1", domain=domain) # type: ignore[arg-type]
|
||||
def test_floating_domain_valid_domains(domain: str):
|
||||
frame = WsFloatingDomain(request_id="r1", domain=domain) # type: ignore[arg-type]
|
||||
assert frame.domain == domain
|
||||
|
||||
|
||||
def test_popup_domain_invalid():
|
||||
def test_floating_domain_invalid():
|
||||
with pytest.raises(ValidationError):
|
||||
WsPopupDomain(request_id="r1", domain="invalid") # type: ignore[arg-type]
|
||||
WsFloatingDomain(request_id="r1", domain="invalid") # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_popup_domain_serializes():
|
||||
d = WsPopupDomain(request_id="r1", domain="notes").model_dump()
|
||||
assert d == {"type": "popup_domain", "request_id": "r1", "domain": "notes"}
|
||||
def test_floating_domain_serializes():
|
||||
d = WsFloatingDomain(request_id="r1", domain="notes").model_dump()
|
||||
assert d == {"type": "floating_domain", "request_id": "r1", "domain": "notes"}
|
||||
|
||||
|
||||
def test_popup_domain_deserializes():
|
||||
raw = {"type": "popup_domain", "request_id": "r1", "domain": "projects"}
|
||||
frame = WsPopupDomain.model_validate(raw)
|
||||
def test_floating_domain_deserializes():
|
||||
raw = {"type": "floating_domain", "request_id": "r1", "domain": "projects"}
|
||||
frame = WsFloatingDomain.model_validate(raw)
|
||||
assert frame.domain == "projects"
|
||||
|
||||
Reference in New Issue
Block a user