@@ -36,13 +36,17 @@ def setUp(self):
3636 user = 'user' ,
3737 password = 'pass' ,
3838 host = 'delphi_database_epidata' ,
39- database = 'epidata ' )
39+ database = 'covid ' )
4040 cur = cnx .cursor ()
4141
42- # clear the `covidcast` table
43- cur .execute ('truncate table covidcast' )
42+ # clear all tables
43+ cur .execute ("truncate table epimetric_load" )
44+ cur .execute ("truncate table epimetric_full" )
45+ cur .execute ("truncate table epimetric_latest" )
46+ cur .execute ("truncate table geo_dim" )
47+ cur .execute ("truncate table signal_dim" )
4448 # reset the `covidcast_meta_cache` table (it should always have one row)
45- cur .execute ('update covidcast_meta_cache set timestamp = 0, epidata = ""' )
49+ cur .execute ('update covidcast_meta_cache set timestamp = 0, epidata = "[] "' )
4650 cnx .commit ()
4751 cur .close ()
4852
@@ -67,30 +71,29 @@ def test_caching(self):
6771
6872 # insert dummy data
6973 self .cur .execute (f'''
70- INSERT INTO
71- `covidcast` (`id`, `source`, `signal`, `time_type`, `geo_type`,
72- `time_value`, `geo_value`, `value_updated_timestamp`,
73- `value`, `stderr`, `sample_size`, `direction_updated_timestamp`,
74- `direction`, `issue`, `lag`, `is_latest_issue`, `is_wip`,`missing_value`,
75- `missing_stderr`,`missing_sample_size`)
74+ INSERT INTO `signal_dim` (`signal_key_id`, `source`, `signal`)
7675 VALUES
77- (0, 'src', 'sig', 'day', 'state', 20200422, 'pa',
78- 123, 1, 2, 3, 456, 1, 20200422, 0, 1, False, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } ),
79- (0, 'src', 'sig', 'day', 'state', 20200422, 'wa',
80- 789, 1, 2, 3, 456, 1, 20200423, 1, 1, False, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } )
76+ (42, 'src', 'sig');
77+ ''' )
78+ self .cur .execute (f'''
79+ INSERT INTO `geo_dim` (`geo_key_id`, `geo_type`, `geo_value`)
80+ VALUES
81+ (96, 'state', 'pa'),
82+ (97, 'state', 'wa');
8183 ''' )
8284 self .cur .execute (f'''
8385 INSERT INTO
84- `covidcast ` (`id `, `source `, `signal `, `time_type`, `geo_type`,
85- `time_value`, `geo_value`, ` value_updated_timestamp`,
86- `value`, `stderr`, `sample_size`, `direction_updated_timestamp`,
87- `direction`, ` issue`, `lag`, `is_latest_issue`, `is_wip`, `missing_value`,
88- `missing_stderr`,`missing_sample_size`)
86+ `epimetric_latest ` (`epimetric_id `, `signal_key_id `, `geo_key_id `, `time_type`,
87+ `time_value`, `value_updated_timestamp`,
88+ `value`, `stderr`, `sample_size`,
89+ `issue`, `lag`, `missing_value`,
90+ `missing_stderr`,`missing_sample_size`)
8991 VALUES
90- (100, 'src', 'wip_sig', 'day', 'state', 20200422, 'pa',
91- 456, 4, 5, 6, 789, -1, 20200422, 0, 1, True, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } )
92+ (15, 42, 96, 'day', 20200422,
93+ 123, 1, 2, 3, 20200422, 0, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } ),
94+ (16, 42, 97, 'day', 20200422,
95+ 789, 1, 2, 3, 20200423, 1, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } )
9296 ''' )
93-
9497 self .cnx .commit ()
9598
9699 # make sure the live utility is serving something sensible
0 commit comments