Skip to content

Commit 3adce47

Browse files
committed
Add private calls
1 parent 3dae260 commit 3adce47

File tree

1 file changed

+79
-1
lines changed

1 file changed

+79
-1
lines changed

tests/test_epidata_calls.py

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
import os
12
from epidatpy.request import Epidata, EpiRange
23

34
# Requirements to run these:
4-
# DELPHI_EPIDATA_KEY environment variable is set https://api.delphi.cmu.edu/epidata/admin/registration_form
5+
# - DELPHI_EPIDATA_KEY environment variable is set https://api.delphi.cmu.edu/epidata/admin/registration_form
6+
# - it has access to the private endpoints being tested
7+
8+
auth = os.environ.get("DELPHI_EPIDATA_KEY")
9+
10+
def test_pvt_cdc() -> None:
11+
apicall = Epidata.pvt_cdc(
12+
auth = auth,
13+
locations = "fl,ca",
14+
epiweeks = EpiRange(201501, 201601)
15+
)
16+
data = apicall.json()
17+
assert(len(data) > 0)
518

619
def test_pub_covid_hosp_facility_lookup() -> None:
720
apicall = Epidata.pub_covid_hosp_facility_lookup(state="fl")
@@ -74,6 +87,16 @@ def test_pub_dengue_nowcast() -> None:
7487
data = apicall.json()
7588
assert(len(data) > 0)
7689

90+
def test_pvt_dengue_sensors() -> None:
91+
apicall = Epidata.pvt_dengue_sensors(
92+
auth = auth,
93+
names = "ght",
94+
locations = "ag",
95+
epiweeks = EpiRange(201501, 202001)
96+
)
97+
data = apicall.json()
98+
assert(len(data) > 0)
99+
77100
def test_pub_ecdc_ili() -> None:
78101
apicall = Epidata.pub_ecdc_ili(
79102
regions = "austria",
@@ -119,6 +142,16 @@ def test_pub_gft() -> None:
119142
data = apicall.json()
120143
assert(len(data) > 0)
121144

145+
def test_pvt_ght() -> None:
146+
apicall = Epidata.pvt_ght(
147+
auth = auth,
148+
locations = "ma",
149+
epiweeks = EpiRange(199301, 202304),
150+
query = "how to get over the flu"
151+
)
152+
data = apicall.json()
153+
assert(len(data) > 0)
154+
122155
def test_pub_kcdc_ili() -> None:
123156
apicall = Epidata.pub_kcdc_ili(
124157
regions = "ROK",
@@ -127,6 +160,13 @@ def test_pub_kcdc_ili() -> None:
127160
data = apicall.json(disable_date_parsing=True)
128161
assert(len(data) > 0)
129162

163+
def test_pvt_meta_norostat() -> None:
164+
apicall = Epidata.pvt_meta_norostat(
165+
auth = auth
166+
)
167+
data = apicall.classic()
168+
assert(len(data) > 0)
169+
130170
def test_pub_meta() -> None:
131171
apicall = Epidata.pub_meta()
132172
data = apicall.classic() # only supports classic
@@ -148,6 +188,15 @@ def test_pub_nidss_flu() -> None:
148188
data = apicall.json(disable_date_parsing=True)
149189
assert(len(data) > 0)
150190

191+
def test_pvt_norostat() -> None:
192+
apicall = Epidata.pvt_norostat(
193+
auth = auth,
194+
location = "1",
195+
epiweeks = 201233
196+
)
197+
data = apicall.json()
198+
assert(len(data) > 0)
199+
151200
def test_pub_nowcast() -> None:
152201
apicall = Epidata.pub_nowcast(
153202
locations = "ca",
@@ -164,6 +213,35 @@ def test_pub_paho_dengue() -> None:
164213
data = apicall.json(disable_date_parsing=True)
165214
assert(len(data) > 0)
166215

216+
def test_pvt_quidel() -> None:
217+
apicall = Epidata.pvt_quidel(
218+
auth = auth,
219+
locations = "hhs1",
220+
epiweeks = EpiRange(201201, 202001)
221+
)
222+
data = apicall.json()
223+
assert(len(data) > 0)
224+
225+
def test_pvt_sensors() -> None:
226+
apicall = Epidata.pvt_sensors(
227+
auth = auth,
228+
names = "sar3",
229+
locations = "nat",
230+
epiweeks = EpiRange(201501, 202001)
231+
)
232+
data = apicall.json()
233+
assert(len(data) > 0)
234+
235+
def test_pvt_twitter() -> None:
236+
apicall = Epidata.pvt_twitter(
237+
auth = auth,
238+
locations = "CA",
239+
time_type = "week",
240+
time_values = EpiRange(201501, 202001)
241+
)
242+
data = apicall.json()
243+
assert(len(data) > 0)
244+
167245
def test_pub_wiki() -> None:
168246
apicall = Epidata.pub_wiki(
169247
articles = "avian_influenza",

0 commit comments

Comments
 (0)