def test_many_days(self, celery, geoip_data, redis, stats):
    bhutan_ip = geoip_data['Bhutan']['ip']
    london_ip = geoip_data['London']['ip']
    days_6 = (self.today - timedelta(days=6)).strftime('%Y-%m-%d')
    days_7 = (self.today - timedelta(days=7)).strftime('%Y-%m-%d')
    redis.pfadd(('apiuser:submit:test:' + self.today_str), '127.0.0.1', bhutan_ip)
    redis.pfadd(('apiuser:submit:test:' + days_6), '127.0.0.1', bhutan_ip, london_ip)
    redis.pfadd(('apiuser:submit:test:' + days_7), bhutan_ip)
    monitor_api_users.delay().get()
    stats.check(gauge=[('submit.user', 1, 2, ['key:test', 'interval:1d']), ('submit.user', 1, 3, ['key:test', 'interval:7d'])])
    assert (not redis.exists(('apiuser:submit:test:' + days_7)))
def test_many_days(self, celery, geoip_data, redis, stats):
    bhutan_ip = geoip_data['Bhutan']['ip']
    london_ip = geoip_data['London']['ip']
    days_6 = (self.today - timedelta(days=6)).strftime('%Y-%m-%d')
    days_7 = (self.today - timedelta(days=7)).strftime('%Y-%m-%d')
    redis.pfadd(('apiuser:submit:test:' + self.today_str), '127.0.0.1', bhutan_ip)
    redis.pfadd(('apiuser:submit:test:' + days_6), '127.0.0.1', bhutan_ip, london_ip)
    redis.pfadd(('apiuser:submit:test:' + days_7), bhutan_ip)
    monitor_api_users.delay().get()
    stats.check(gauge=[('submit.user', 1, 2, ['key:test', 'interval:1d']), ('submit.user', 1, 3, ['key:test', 'interval:7d'])])
    assert (not redis.exists(('apiuser:submit:test:' + days_7)))