|
11 | 11 |
|
12 | 12 | from delphi.epidata.maintenance.covidcast_meta_cache_updater import main as update_cache
|
13 | 13 | from delphi.epidata.acquisition.covidcast.test_utils import CovidcastBase, CovidcastTestRow
|
| 14 | +from delphi.epidata.maintenance.coverage_crossref_updater import main as update_crossref |
| 15 | + |
14 | 16 |
|
15 | 17 | # use the local instance of the Epidata API
|
16 | 18 | BASE_URL = "http://delphi_web_epidata/epidata/covidcast"
|
@@ -385,3 +387,25 @@ def test_coverage(self):
|
385 | 387 | with self.subTest("invalid geo_type"):
|
386 | 388 | out = self._fetch("/coverage", signal=first.signal_pair(), geo_type="doesnt_exist", format="json")
|
387 | 389 | self.assertEqual(len(out), 0)
|
| 390 | + |
| 391 | + def test_indicator_geo_coverage(self): |
| 392 | + """Request a geo_type:geo_value from the /indicator_geo_coverage endpoint.""" |
| 393 | + |
| 394 | + self._insert_rows([ |
| 395 | + CovidcastTestRow.make_default_row(geo_type="state", geo_value="pa"), |
| 396 | + CovidcastTestRow.make_default_row(geo_type="state", geo_value="ny"), |
| 397 | + CovidcastTestRow.make_default_row(geo_type="state", geo_value="ny", signal="sig2"), |
| 398 | + ]) |
| 399 | + |
| 400 | + update_crossref() |
| 401 | + |
| 402 | + response = requests.get( |
| 403 | + f"{BASE_URL}/indicator_geo_coverage", |
| 404 | + params=dict(data_source="src", signals="sig"), |
| 405 | + ) |
| 406 | + response.raise_for_status() |
| 407 | + out = response.json() |
| 408 | + |
| 409 | + self.assertEqual(len(out["epidata"]), 2) |
| 410 | + self.assertEqual(out["epidata"], ['state:ny', 'state:pa']) |
| 411 | + |
0 commit comments