Exemplo n.º 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
Exemplo n.º 2
0
def test_body():
    serializer = RawSerializer()
    obj = object()
    assert obj == serializer.serialize_body(obj)
    assert obj == serializer.deserialize_body(obj)
Exemplo n.º 3
0
def test_header():
    serializer = RawSerializer()
    obj = object()
    assert obj == serializer.serialize_header(obj)
    assert obj == serializer.deserialize_header(obj)