4
4
import unittest
5
5
6
6
import pandas as pd
7
+ from redis import Redis
7
8
8
9
from delphi_utils import Nans
9
10
from delphi .epidata .common .covidcast_row import CovidcastRow
10
11
from delphi .epidata .acquisition .covidcast .database import Database
12
+ from delphi .epidata .server ._config import REDIS_HOST , REDIS_PASSWORD
11
13
from delphi .epidata .server .utils .dates import day_to_time_value , time_value_to_day
12
14
import delphi .operations .secrets as secrets
13
15
14
16
# all the Nans we use here are just one value, so this is a shortcut to it:
15
17
nmv = Nans .NOT_MISSING .value
16
18
17
- # TODO replace these real geo_values with fake values, and use patch and mock to mock the return values of
19
+ # TODO replace these real geo_values with fake values, and use patch and mock to mock the return values of
18
20
# delphi_utils.geomap.GeoMapper().get_geo_values(geo_type) in parse_geo_sets() of _params.py
19
21
20
22
FIPS = ['04019' , '19143' , '29063' , '36083' ] # Example list of valid FIPS codes as strings
@@ -166,19 +168,25 @@ def setUp(self):
166
168
self .localSetUp ()
167
169
self ._db ._connection .commit ()
168
170
171
+ # clear all rate-limiting info from redis
172
+ r = Redis (host = REDIS_HOST , password = REDIS_PASSWORD )
173
+ for k in r .keys ("LIMITER/*" ):
174
+ r .delete (k )
175
+
176
+
169
177
def tearDown (self ):
170
178
# close and destroy conenction to the database
171
179
self .localTearDown ()
172
180
self ._db .disconnect (False )
173
181
del self ._db
174
182
175
183
def localSetUp (self ):
176
- # stub; override in subclasses to perform custom setup.
184
+ # stub; override in subclasses to perform custom setup.
177
185
# runs after tables have been truncated but before database changes have been committed
178
186
pass
179
187
180
188
def localTearDown (self ):
181
- # stub; override in subclasses to perform custom teardown.
189
+ # stub; override in subclasses to perform custom teardown.
182
190
# runs after database changes have been committed
183
191
pass
184
192
@@ -198,4 +206,4 @@ def params_from_row(self, row: CovidcastTestRow, **kwargs):
198
206
'geo_value' : row .geo_value ,
199
207
}
200
208
ret .update (kwargs )
201
- return ret
209
+ return ret
0 commit comments