Пример #1
0
def test_dispatch():
    dispatcher = RequestDispatcher()

    dispatcher.register(
        r"/hello",
        dummy_endpoint,
        RawSerializer(),
        RawSerializer(),
    )

    endpoint = dispatcher.handlers.get("/hello")[0]
    assert endpoint == dummy_endpoint
Пример #2
0
def test_body():
    serializer = RawSerializer()
    obj = object()
    assert obj == serializer.serialize_body(obj)
    assert obj == serializer.deserialize_body(obj)
Пример #3
0
def test_header():
    serializer = RawSerializer()
    obj = object()
    assert obj == serializer.serialize_header(obj)
    assert obj == serializer.deserialize_header(obj)