@@ -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 signal_load" )
44+ cur .execute ("truncate table signal_history" )
45+ cur .execute ("truncate table signal_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,24 @@ 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`)
76- 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 } )
74+ INSERT INTO `signal_dim` (`signal_key_id`, `source`, `signal`) VALUES (42, 'src', 'sig');
75+ ''' )
76+ self .cur .execute (f'''
77+ INSERT INTO `geo_dim` (`geo_key_id`, `geo_type`, `geo_value`) VALUES (96, 'state', 'pa'), (97, 'state', 'wa');
8178 ''' )
8279 self .cur .execute (f'''
8380 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`)
81+ `signal_latest ` (`signal_data_id `, `signal_key_id `, `geo_key_id `, `time_type`,
82+ `time_value`, `value_updated_timestamp`,
83+ `value`, `stderr`, `sample_size`,
84+ `issue`, `lag`, `missing_value`,
85+ `missing_stderr`,`missing_sample_size`)
8986 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 } )
87+ (15, 42, 96, 'day', 20200422,
88+ 123, 1, 2, 3, 20200422, 0, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } ),
89+ (16, 42, 97, 'day', 20200422,
90+ 789, 1, 2, 3, 20200423, 1, { Nans .NOT_MISSING } , { Nans .NOT_MISSING } , { Nans .NOT_MISSING } )
9291 ''' )
93-
9492 self .cnx .commit ()
9593
9694 # make sure the live utility is serving something sensible
0 commit comments