Skip to content

Commit

Permalink
Test for #157
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Dec 16, 2023
1 parent a39d222 commit be6fb10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test_project/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,18 @@ def test_export_tsv(admin_client, dashboard_db, settings):
@pytest.mark.parametrize("json_disabled", (False, True))
def test_export_json(admin_client, saved_dashboard, settings, json_disabled):
if json_disabled:
settings.DASHBOARD_DISABLE_JSON = False
settings.DASHBOARD_DISABLE_JSON = True

response = admin_client.get("/dashboard/test.json")
if json_disabled:
assert response.status_code == 403
return
assert response.status_code == 200
assert response["Content-Type"] == "application/json"
assert response.json() == {}
assert response.json() == {
"title": "Test dashboard",
"queries": [
{"sql": "select 11 + 33", "rows": [{"?column?": 44}]},
{"sql": "select 22 + 55", "rows": [{"?column?": 77}]},
],
}

0 comments on commit be6fb10

Please sign in to comment.