예제 #1
0
async def test_request_error_404_on_head(loop, auto_close):
    exc = TransportError(404)
    t = AIOHttpTransport([{}], connection_class=DummyConnection, loop=loop,
                         exception=exc)
    auto_close(t)

    ret = await t.perform_request('HEAD', '/')
    assert not ret
예제 #2
0
async def test_request_retry_on_status(loop, auto_close):
    exc = TransportError(500)
    t = AIOHttpTransport([{}], connection_class=DummyConnection, loop=loop,
                         exception=exc, retry_on_status=(500,))
    auto_close(t)

    with pytest.raises(TransportError):
        await t.perform_request('GET', '/')

    conn = await t.get_connection()
    assert len(conn.calls) == 3