mirror of
https://github.com/kc1awv/rrcd.git
synced 2026-06-08 14:11:53 -07:00
20 lines
592 B
Python
20 lines
592 B
Python
from rrcd.codec import decode, encode
|
|
from rrcd.constants import T_ACTION, T_MSG
|
|
from rrcd.envelope import make_envelope, validate_envelope
|
|
|
|
|
|
def test_codec_round_trip() -> None:
|
|
env = make_envelope(T_MSG, src=b"peer", room="#general", body="hello")
|
|
data = encode(env)
|
|
decoded = decode(data)
|
|
assert decoded == env
|
|
validate_envelope(decoded)
|
|
|
|
|
|
def test_codec_round_trip_action() -> None:
|
|
env = make_envelope(T_ACTION, src=b"peer", room="#general", body="waves")
|
|
data = encode(env)
|
|
decoded = decode(data)
|
|
assert decoded == env
|
|
validate_envelope(decoded)
|