async def test_rate_limit_daily_exhaust_fails(event_loop, redis_client):
    rate_limit = RateLimitAggregate(redis_client,
                                    'test_rate_limit_daily_exhaust_fails', 0,
                                    1, 1, 1)

    assert not await rate_limit.use()
    redis_client.close()
async def test_peek_does_not_use(event_loop, redis_client):
    rate_limit = RateLimitAggregate(redis_client, 'test_peek_does_not_use', 1,
                                    None, None, 1)

    assert await rate_limit.use(peek=True)
    assert await rate_limit.use()

    redis_client.close()
async def test_rate_limit_with_all_none(event_loop, redis_client):
    rate_limit = RateLimitAggregate(redis_client,
                                    'test_rate_limit_with_all_none', None,
                                    None, None, None)

    assert await rate_limit.use(peek=True)
    assert await rate_limit.use()

    redis_client.close()
async def test_rate_limit_with_some_none(event_loop, redis_client):
    rate_limit = RateLimitAggregate(redis_client,
                                    'test_rate_limit_with_some_none', 1, None,
                                    None, 1)

    assert await rate_limit.use()
    assert not await rate_limit.daily.use(peek=True)
    assert not await rate_limit.secondly.use(peek=True)

    redis_client.close()
async def test_rate_limit_aggregate_second_exhaust_does_not_effect_minute(
        event_loop, redis_client):
    rate_limit = RateLimitAggregate(
        redis_client,
        'test_rate_limit_aggregate_second_exhaust_does_not_effect_minute', 1,
        1, 1, 0)

    assert not await rate_limit.use()

    assert not await rate_limit.secondly.use(peek=True)
    assert await rate_limit.minutely.use(peek=True)
    assert await rate_limit.hourly.use(peek=True)
    assert await rate_limit.daily.use(peek=True)
    redis_client.close()