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

@@ -41,6 +41,7 @@ from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
from superset.utils.core import get_example_database
from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices
from .base_tests import SupersetTestCase
@@ -270,7 +271,10 @@ class TestImportExport(SupersetTestCase):
self.get_table_by_name("birth_names"), exported_tables[0]
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
@pytest.mark.usefixtures(
"load_world_bank_dashboard_with_slices",
"load_birth_names_dashboard_with_slices",
)
def test_export_2_dashboards(self):
self.login("admin")
birth_dash = self.get_dash_by_slug("births")
@@ -311,6 +315,7 @@ class TestImportExport(SupersetTestCase):
self.get_table_by_name("wb_health_population"), exported_tables[1]
)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_import_1_slice(self):
expected_slice = self.create_slice("Import Me", id=10001)
slc_id = import_chart(expected_slice, None, import_time=1989)
@@ -321,6 +326,7 @@ class TestImportExport(SupersetTestCase):
table_id = self.get_table_by_name("wb_health_population").id
self.assertEqual(table_id, self.get_slice(slc_id).datasource_id)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_import_2_slices_for_same_table(self):
table_id = self.get_table_by_name("wb_health_population").id
# table_id != 666, import func will have to find the table
@@ -363,6 +369,7 @@ class TestImportExport(SupersetTestCase):
imported_dash = self.get_dash(imported_dash_id)
self.assert_dash_equals(empty_dash, imported_dash, check_position=False)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_import_dashboard_1_slice(self):
slc = self.create_slice("health_slc", id=10006)
dash_with_1_slice = self.create_dashboard(