6
6
# - it has access to the private endpoints being tested
7
7
8
8
auth = os .environ .get ("DELPHI_EPIDATA_KEY" )
9
+ secret_cdc = os .environ .get ("SECRET_API_AUTH_CDC" )
10
+ secret_fluview = os .environ .get ("SECRET_API_AUTH_FLUVIEW" )
11
+ secret_ght = os .environ .get ("SECRET_API_AUTH_GHT" )
12
+ secret_norostat = os .environ .get ("SECRET_API_AUTH_NOROSTAT" )
13
+ secret_quidel = os .environ .get ("SECRET_API_AUTH_QUIDEL" )
14
+ secret_sensors = os .environ .get ("SECRET_API_AUTH_SENSORS" )
15
+ secret_twitter = os .environ .get ("SECRET_API_AUTH_TWITTER" )
9
16
10
17
def test_pvt_cdc () -> None :
11
18
apicall = Epidata .pvt_cdc (
12
- auth = auth ,
19
+ auth = secret_cdc ,
13
20
locations = "fl,ca" ,
14
21
epiweeks = EpiRange (201501 , 201601 )
15
22
)
16
- data = apicall .json ()
23
+ data = apicall .df ()
17
24
assert (len (data ) > 0 )
18
25
19
26
def test_pub_covid_hosp_facility_lookup () -> None :
20
27
apicall = Epidata .pub_covid_hosp_facility_lookup (state = "fl" )
21
- data = apicall .json ()
28
+ data = apicall .df ()
22
29
assert (len (data ) > 0 )
23
30
24
31
apicall = Epidata .pub_covid_hosp_facility_lookup (city = "southlake" )
25
- data = apicall .json ()
32
+ data = apicall .df ()
26
33
assert (len (data ) > 0 )
27
34
28
35
def test_pub_covid_hosp_facility () -> None :
29
36
apicall = Epidata .pub_covid_hosp_facility (
30
37
hospital_pks = "100075" ,
31
38
collection_weeks = EpiRange (20200101 , 20200501 ))
32
- data = apicall .json ()
39
+ data = apicall .df ()
33
40
assert (len (data ) > 0 )
34
41
35
42
apicall = Epidata .pub_covid_hosp_facility (
36
43
hospital_pks = "100075" ,
37
44
collection_weeks = EpiRange (202001 , 202005 ))
38
- data = apicall .json ()
45
+ data = apicall .df ()
39
46
assert (len (data ) > 0 ) # fails
40
47
41
48
def test_pub_covid_hosp_state_timeseries () -> None :
42
49
apicall = Epidata .pub_covid_hosp_state_timeseries (
43
50
states = "fl" ,
44
51
dates = EpiRange (20200101 , 20200501 ))
45
- data = apicall .json ()
52
+ data = apicall .df ()
46
53
assert (len (data ) > 0 )
47
54
48
55
def test_pub_covidcast_meta () -> None :
49
56
apicall = Epidata .pub_covidcast_meta ()
50
- data = apicall .json ()
57
+ data = apicall .df ()
51
58
assert (len (data ) > 0 )
52
59
53
60
def test_pub_covidcast () -> None :
@@ -58,7 +65,7 @@ def test_pub_covidcast() -> None:
58
65
time_type = "day" ,
59
66
geo_values = ["ca" , "fl" ],
60
67
time_values = EpiRange (20200601 , 20200801 ))
61
- data = apicall .json ()
68
+ data = apicall .df ()
62
69
assert (len (data ) > 0 )
63
70
64
71
apicall = Epidata .pub_covidcast (
@@ -68,7 +75,7 @@ def test_pub_covidcast() -> None:
68
75
time_type = "day" ,
69
76
geo_values = "*" ,
70
77
time_values = EpiRange (20200601 , 20200801 ))
71
- data = apicall .json ()
78
+ data = apicall .df ()
72
79
assert (len (data ) > 0 )
73
80
74
81
def test_pub_delphi () -> None :
@@ -84,17 +91,17 @@ def test_pub_dengue_nowcast() -> None:
84
91
locations = "pr" ,
85
92
epiweeks = EpiRange (201401 , 202301 )
86
93
)
87
- data = apicall .json ()
94
+ data = apicall .df ()
88
95
assert (len (data ) > 0 )
89
96
90
97
def test_pvt_dengue_sensors () -> None :
91
98
apicall = Epidata .pvt_dengue_sensors (
92
- auth = auth ,
99
+ auth = secret_norostat ,
93
100
names = "ght" ,
94
101
locations = "ag" ,
95
102
epiweeks = EpiRange (201501 , 202001 )
96
103
)
97
- data = apicall .json ()
104
+ data = apicall .df ()
98
105
assert (len (data ) > 0 )
99
106
100
107
def test_pub_ecdc_ili () -> None :
@@ -139,17 +146,17 @@ def test_pub_gft() -> None:
139
146
locations = "hhs1" ,
140
147
epiweeks = EpiRange (201201 , 202001 )
141
148
)
142
- data = apicall .json ()
149
+ data = apicall .df ()
143
150
assert (len (data ) > 0 )
144
151
145
152
def test_pvt_ght () -> None :
146
153
apicall = Epidata .pvt_ght (
147
- auth = auth ,
154
+ auth = secret_ght ,
148
155
locations = "ma" ,
149
156
epiweeks = EpiRange (199301 , 202304 ),
150
157
query = "how to get over the flu"
151
158
)
152
- data = apicall .json ()
159
+ data = apicall .df ()
153
160
assert (len (data ) > 0 )
154
161
155
162
def test_pub_kcdc_ili () -> None :
@@ -162,7 +169,7 @@ def test_pub_kcdc_ili() -> None:
162
169
163
170
def test_pvt_meta_norostat () -> None :
164
171
apicall = Epidata .pvt_meta_norostat (
165
- auth = auth
172
+ auth = secret_norostat
166
173
)
167
174
data = apicall .classic ()
168
175
assert (len (data ) > 0 )
@@ -177,7 +184,7 @@ def test_pub_nidss_dengue() -> None:
177
184
locations = "taipei" ,
178
185
epiweeks = EpiRange (201201 , 201301 )
179
186
)
180
- data = apicall .json ()
187
+ data = apicall .df ()
181
188
assert (len (data ) > 0 )
182
189
183
190
def test_pub_nidss_flu () -> None :
@@ -190,19 +197,20 @@ def test_pub_nidss_flu() -> None:
190
197
191
198
def test_pvt_norostat () -> None :
192
199
apicall = Epidata .pvt_norostat (
193
- auth = auth ,
200
+ auth = secret_norostat ,
194
201
location = "1" ,
195
202
epiweeks = 201233
196
203
)
197
- data = apicall .json ()
198
- assert (len (data ) > 0 )
204
+ data = apicall .df ()
205
+ # TODO: Norostat is known to not return data
206
+ # assert(len(data) > 0)
199
207
200
208
def test_pub_nowcast () -> None :
201
209
apicall = Epidata .pub_nowcast (
202
210
locations = "ca" ,
203
211
epiweeks = EpiRange (201201 , 201301 )
204
212
)
205
- data = apicall .json ()
213
+ data = apicall .df ()
206
214
assert (len (data ) > 0 )
207
215
208
216
def test_pub_paho_dengue () -> None :
@@ -215,31 +223,31 @@ def test_pub_paho_dengue() -> None:
215
223
216
224
def test_pvt_quidel () -> None :
217
225
apicall = Epidata .pvt_quidel (
218
- auth = auth ,
226
+ auth = secret_quidel ,
219
227
locations = "hhs1" ,
220
228
epiweeks = EpiRange (201201 , 202001 )
221
229
)
222
- data = apicall .json ()
230
+ data = apicall .df ()
223
231
assert (len (data ) > 0 )
224
232
225
233
def test_pvt_sensors () -> None :
226
234
apicall = Epidata .pvt_sensors (
227
- auth = auth ,
235
+ auth = secret_sensors ,
228
236
names = "sar3" ,
229
237
locations = "nat" ,
230
238
epiweeks = EpiRange (201501 , 202001 )
231
239
)
232
- data = apicall .json ()
240
+ data = apicall .df ()
233
241
assert (len (data ) > 0 )
234
242
235
243
def test_pvt_twitter () -> None :
236
244
apicall = Epidata .pvt_twitter (
237
- auth = auth ,
245
+ auth = secret_twitter ,
238
246
locations = "CA" ,
239
247
time_type = "week" ,
240
248
time_values = EpiRange (201501 , 202001 )
241
249
)
242
- data = apicall .json ()
250
+ data = apicall .df ()
243
251
assert (len (data ) > 0 )
244
252
245
253
def test_pub_wiki () -> None :
@@ -248,5 +256,5 @@ def test_pub_wiki() -> None:
248
256
time_type = "week" ,
249
257
time_values = EpiRange (201501 , 201601 )
250
258
)
251
- data = apicall .json ()
259
+ data = apicall .df ()
252
260
assert (len (data ) > 0 )
0 commit comments