Rename all project references from quicproquo/qpq to quicprochat/qpc across documentation, Docker configuration, CI workflows, packaging scripts, operational configs, and build tooling. - Docker: crate paths, binary names, user/group, data dirs, env vars - CI: workflow crate references, binary names, artifact names - Docs: all markdown files under docs/, SDK READMEs, book.toml - Packaging: OpenWrt Makefile, init script, UCI config (file renames) - Scripts: justfile, dev-shell, screenshot, cross-compile, ai_team - Operations: Prometheus config, alert rules, Grafana dashboard - Config: .env.example (QPQ_* → QPC_*), CODEOWNERS paths - Top-level: README, CONTRIBUTING, ROADMAP, CLAUDE.md
42 lines
928 B
Python
42 lines
928 B
Python
"""Tests for the v2 wire format encoder/decoder."""
|
|
|
|
from quicprochat.wire import (
|
|
HEADER_SIZE,
|
|
encode_frame,
|
|
decode_header,
|
|
HEALTH,
|
|
ENQUEUE,
|
|
)
|
|
|
|
|
|
def test_header_size():
|
|
assert HEADER_SIZE == 10
|
|
|
|
|
|
def test_encode_decode_roundtrip():
|
|
payload = b"\x0a\x05hello"
|
|
frame = encode_frame(HEALTH, 42, payload)
|
|
|
|
assert len(frame) == HEADER_SIZE + len(payload)
|
|
|
|
method_id, req_id, length = decode_header(frame)
|
|
assert method_id == HEALTH
|
|
assert req_id == 42
|
|
assert length == len(payload)
|
|
assert frame[HEADER_SIZE:] == payload
|
|
|
|
|
|
def test_empty_payload():
|
|
frame = encode_frame(ENQUEUE, 1, b"")
|
|
method_id, req_id, length = decode_header(frame)
|
|
assert method_id == ENQUEUE
|
|
assert req_id == 1
|
|
assert length == 0
|
|
|
|
|
|
def test_decode_header_too_short():
|
|
import pytest
|
|
|
|
with pytest.raises(ValueError, match="header too short"):
|
|
decode_header(b"\x00\x01")
|