Ejemplo n.º 1
0
def test_use_connection_explicit_redis(redis, loop):
    """Pass redis connection explicitly."""

    connection = yield from find_connection(loop)
    yield from use_connection(redis=connection)
    assert get_current_connection() == connection
    push_connection(redis)      # Make test finalizer happy.
Ejemplo n.º 2
0
def test_use_connection(redis, loop):
    """Replace connection stack."""

    kwargs = dict(address=('localhost', 6379), loop=loop)
    yield from use_connection(**kwargs)
    assert get_current_connection() != redis
    push_connection(redis)      # Make test finalizer happy.