test: World bank examples (#12161)

* add world bank data fixture

* fix fixture cleanup, add fixture to dashboard_tests

* apply world bank fixtures, fix tests

* fix fixture typo, dashboard ids

* fix export dashboard metadata

* fix test_export_dashboard_command_key_order

* fix export dash tests, not add row when no orphans

* debug timeout

* fixes after merge

* fix lint

* run pre-commit

* comment test for debug

* fix save.test.js

Co-authored-by: Karol Kostrzewa <karol.kostrzewa@polidea.com>
This commit is contained in:
Karol Kostrzewa
2021-01-13 23:20:05 +01:00
committed by GitHub
parent 87ac22ba52
commit 241f380e2e
22 changed files with 807 additions and 225 deletions

View File

@@ -49,6 +49,7 @@ from tests.fixtures.importexport import (
dataset_metadata_config,
)
from tests.utils.get_dashboards import get_dashboards_ids
from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices
DASHBOARDS_FIXTURE_COUNT = 10
@@ -1102,13 +1103,17 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin):
db.session.delete(user_alpha2)
db.session.commit()
@pytest.mark.usefixtures(
"load_world_bank_dashboard_with_slices",
"load_birth_names_dashboard_with_slices",
)
def test_export(self):
"""
Dashboard API: Test dashboard export
"""
self.login(username="admin")
argument = [1, 2]
uri = f"api/v1/dashboard/export/?q={prison.dumps(argument)}"
dashboards_ids = get_dashboards_ids(db, ["world_health", "births"])
uri = f"api/v1/dashboard/export/?q={prison.dumps(dashboards_ids)}"
# freeze time to ensure filename is deterministic
with freeze_time("2020-01-01T00:00:00Z"):