mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
23 lines
754 B
Python
23 lines
754 B
Python
import pytest
|
|
import uuid
|
|
import royalherald as h
|
|
|
|
|
|
async def echo_request_handler(message):
|
|
return message
|
|
|
|
|
|
def test_package_serialization():
|
|
pkg = h.Package({"ciao": "ciao"},
|
|
source=str(uuid.uuid4()),
|
|
destination=str(uuid.uuid4()),
|
|
source_conv_id=str(uuid.uuid4()),
|
|
destination_conv_id=str(uuid.uuid4()))
|
|
assert pkg == h.Package.from_dict(pkg.to_dict())
|
|
assert pkg == h.Package.from_json_string(pkg.to_json_string())
|
|
assert pkg == h.Package.from_json_bytes(pkg.to_json_bytes())
|
|
|
|
|
|
def test_request_creation():
|
|
request = h.Request("pytest", {"testing": "is fun", "bugs": "are less fun"})
|
|
assert request == h.Request.from_dict(request.to_dict())
|