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

@@ -29,6 +29,9 @@ import random
from flask import current_app, g
from sqlalchemy import Float, Date, String
from superset.models.dashboard import Dashboard
from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices
from superset import app, appbuilder, db, security_manager, viz, ConnectorRegistry
from superset.connectors.druid.models import DruidCluster, DruidDatasource
from superset.connectors.sqla.models import RowLevelSecurityFilter, SqlaTable
@@ -260,6 +263,7 @@ class TestRolePermission(SupersetTestCase):
session.delete(stored_table)
session.commit()
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_set_perm_druid_datasource(self):
self.create_druid_test_objects()
session = db.session
@@ -534,7 +538,12 @@ class TestRolePermission(SupersetTestCase):
self.assertIsNotNone(vm)
delete_schema_perm("[examples].[2]")
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_gamma_user_schema_access_to_dashboards(self):
dash = db.session.query(Dashboard).filter_by(slug="world_health").first()
dash.published = True
db.session.commit()
self.login(username="gamma")
data = str(self.client.get("api/v1/dashboard/").data)
self.assertIn("/superset/dashboard/world_health/", data)
@@ -546,6 +555,7 @@ class TestRolePermission(SupersetTestCase):
self.assertIn("wb_health_population", data)
self.assertNotIn("birth_names", data)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_gamma_user_schema_access_to_charts(self):
self.login(username="gamma")
data = str(self.client.get("api/v1/chart/").data)
@@ -820,6 +830,7 @@ class TestRolePermission(SupersetTestCase):
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_admin_permissions(self):
self.assert_can_gamma(get_perm_tuples("Admin"))
self.assert_can_alpha(get_perm_tuples("Admin"))