|
| 1 | +from urllib.parse import quote |
| 2 | + |
1 | 3 | import pytest |
2 | 4 | from django.core.management import call_command |
3 | 5 | from rest_framework.test import APIClient |
@@ -46,22 +48,17 @@ def test_command_seeds_metrics_dataset_and_data_is_queryable_via_api(self): |
46 | 48 | assert sample_row is not None |
47 | 49 |
|
48 | 50 | api_client = APIClient() |
49 | | - response = api_client.post( |
50 | | - path="/api/tables/v4/", |
51 | | - data={ |
52 | | - "file_format": "svg", |
53 | | - "plots": [ |
54 | | - { |
55 | | - "topic": sample_row.topic, |
56 | | - "metric": sample_row.metric, |
57 | | - "date_from": "2020-01-01", |
58 | | - "chart_type": "bar", |
59 | | - } |
60 | | - ], |
61 | | - }, |
62 | | - format="json", |
| 51 | + path = ( |
| 52 | + "/api/public/timeseries/" |
| 53 | + f"themes/{quote(sample_row.theme, safe='')}/" |
| 54 | + f"sub_themes/{quote(sample_row.sub_theme, safe='')}/" |
| 55 | + f"topics/{quote(sample_row.topic, safe='')}/" |
| 56 | + f"geography_types/{quote(sample_row.geography_type, safe='')}/" |
| 57 | + f"geographies/{quote(sample_row.geography, safe='')}/" |
| 58 | + "metrics/" |
63 | 59 | ) |
| 60 | + response = api_client.get(path=path, format="json") |
64 | 61 |
|
65 | 62 | assert response.status_code == HTTP_OK |
66 | | - assert len(response.data) > 0 |
67 | | - assert len(response.data[0]["values"]) > 0 |
| 63 | + assert "metrics" in response.data |
| 64 | + assert sample_row.metric in response.data["metrics"] |
0 commit comments