def test_monitor_api_keys_multiple(self, celery, redis, stats):
    now = util.utcnow()
    today = now.strftime('%Y%m%d')
    yesterday = (now - timedelta(hours=24)).strftime('%Y%m%d')
    data = {'test': {'v1.search': 11, 'v1.geolocate': 13}, 'no_key_1': {'v1.search': 12}, 'no_key_2': {'v1.geolocate': 15}}
    for (key, paths) in data.items():
        for (path, value) in paths.items():
            rate_key = ('apilimit:%s:%s:%s' % (key, path, today))
            redis.incr(rate_key, value)
            rate_key = ('apilimit:%s:%s:%s' % (key, path, yesterday))
            redis.incr(rate_key, (value - 10))
    redis.lpush('default', 1, 2)
    redis.set('cache_something', '{}')
    monitor_api_key_limits.delay().get()
    stats.check(gauge=[('api.limit', ['key:test', 'path:v1.geolocate']), ('api.limit', ['key:test', 'path:v1.search']), ('api.limit', ['key:no_key_1', 'path:v1.search']), ('api.limit', ['key:no_key_2', 'path:v1.geolocate'])])
def test_monitor_api_keys_multiple(self, celery, redis, stats):
    now = util.utcnow()
    today = now.strftime('%Y%m%d')
    yesterday = (now - timedelta(hours=24)).strftime('%Y%m%d')
    data = {'test': {'v1.search': 11, 'v1.geolocate': 13}, 'no_key_1': {'v1.search': 12}, 'no_key_2': {'v1.geolocate': 15}}
    for (key, paths) in data.items():
        for (path, value) in paths.items():
            rate_key = ('apilimit:%s:%s:%s' % (key, path, today))
            redis.incr(rate_key, value)
            rate_key = ('apilimit:%s:%s:%s' % (key, path, yesterday))
            redis.incr(rate_key, (value - 10))
    redis.lpush('default', 1, 2)
    redis.set('cache_something', '{}')
    monitor_api_key_limits.delay().get()
    stats.check(gauge=[('api.limit', ['key:test', 'path:v1.geolocate']), ('api.limit', ['key:test', 'path:v1.search']), ('api.limit', ['key:no_key_1', 'path:v1.search']), ('api.limit', ['key:no_key_2', 'path:v1.geolocate'])])