Esempio n. 1
0
def test_dispatch_error_message_to_client():
    class MyPage(Page):
        t1 = Table(
            auto__model=T1,
            columns__foo=dict(
                filter__include=True,
            ),
            columns__bar=dict(
                filter__include=True,
            ),
        )

        t2 = Table(
            auto__model=T2,
            columns__foo=dict(
                filter__include=True,
            ),
            columns__bar=dict(
                filter__include=True,
            ),
        )

    response = request_with_middleware(MyPage(), req('get', **{'/qwe': ''}))
    data = json.loads(response.content)
    assert data == dict(error='Invalid endpoint path')
Esempio n. 2
0
def test_middleware_fallthrough_on_non_part():
    sentinel = object()
    assert request_with_middleware(response=sentinel, data={}) is sentinel
Esempio n. 3
0
def test_middleware_fallthrough_on_non_part():
    sentinel = object()
    assert request_with_middleware(sentinel, req('get')) is sentinel
Esempio n. 4
0
def test_dispatch_error_message_to_client():
    response = request_with_middleware(response=MyPage(), data={'/qwe': ''})
    data = json.loads(response.content)
    assert data == dict(error='Invalid endpoint path')