|
11 | 11 | @pytest.mark.skipif(TEST_API_KEY is None, reason="no enigma_api_key")
|
12 | 12 | class TestEnigma(object):
|
13 | 13 |
|
| 14 | + @property |
| 15 | + def dataset_id(): |
| 16 | + """ |
| 17 | + USDA Food Recall Archive |
| 18 | + Selected for being a relatively small dataset. |
| 19 | + https://public.enigma.com/datasets/292129b0-1275-44c8-a6a3-2a0881f24fe1 |
| 20 | + """ |
| 21 | + return "292129b0-1275-44c8-a6a3-2a0881f24fe1" |
| 22 | + |
14 | 23 | @classmethod
|
15 | 24 | def setup_class(cls):
|
16 | 25 | pytest.importorskip("lxml")
|
17 | 26 |
|
18 | 27 | def test_enigma_datareader(self):
|
19 | 28 | try:
|
20 |
| - df = web.DataReader('enigma.inspections.restaurants.fl', |
| 29 | + df = web.DataReader(self.dataset_id, |
21 | 30 | 'enigma', access_key=TEST_API_KEY)
|
22 |
| - assert 'serialid' in df.columns |
| 31 | + assert 'case_number' in df.columns |
23 | 32 | except HTTPError as e:
|
24 | 33 | pytest.skip(e)
|
25 | 34 |
|
26 | 35 | def test_enigma_get_data_enigma(self):
|
27 | 36 | try:
|
28 |
| - df = pdr.get_data_enigma( |
29 |
| - 'enigma.inspections.restaurants.fl', TEST_API_KEY) |
30 |
| - assert 'serialid' in df.columns |
| 37 | + df = pdr.get_data_enigma(self.dataset_id, TEST_API_KEY) |
| 38 | + assert 'case_number' in df.columns |
31 | 39 | except HTTPError as e:
|
32 | 40 | pytest.skip(e)
|
33 | 41 |
|
34 | 42 | def test_bad_key(self):
|
35 | 43 | with pytest.raises(HTTPError):
|
36 |
| - web.DataReader('enigma.inspections.restaurants.fl', |
| 44 | + web.DataReader(self.dataset_id, |
37 | 45 | 'enigma', access_key=TEST_API_KEY + 'xxx')
|
38 | 46 |
|
39 |
| - def test_bad_url(self): |
| 47 | + def test_bad_dataset_id(self): |
40 | 48 | with pytest.raises(HTTPError):
|
41 |
| - web.DataReader('enigma.inspections.restaurants.fllzzy', |
| 49 | + web.DataReader('zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzz', |
42 | 50 | 'enigma', access_key=TEST_API_KEY)
|
0 commit comments