mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: add export_related flag (#19215)
* feat: add export_related flag * Fix lint
This commit is contained in:
@@ -423,6 +423,28 @@ class TestExportDashboardsCommand(SupersetTestCase):
|
||||
"DASHBOARD_VERSION_KEY": "v2",
|
||||
}
|
||||
|
||||
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
|
||||
@patch("superset.security.manager.g")
|
||||
@patch("superset.views.base.g")
|
||||
def test_export_dashboard_command_no_related(self, mock_g1, mock_g2):
|
||||
"""
|
||||
Test that only the dashboard is exported when export_related=False.
|
||||
"""
|
||||
mock_g1.user = security_manager.find_user("admin")
|
||||
mock_g2.user = security_manager.find_user("admin")
|
||||
|
||||
example_dashboard = (
|
||||
db.session.query(Dashboard).filter_by(slug="world_health").one()
|
||||
)
|
||||
command = ExportDashboardsCommand([example_dashboard.id], export_related=False)
|
||||
contents = dict(command.run())
|
||||
|
||||
expected_paths = {
|
||||
"metadata.yaml",
|
||||
"dashboards/World_Banks_Data.yaml",
|
||||
}
|
||||
assert expected_paths == set(contents.keys())
|
||||
|
||||
|
||||
class TestImportDashboardsCommand(SupersetTestCase):
|
||||
def test_import_v0_dashboard_cli_export(self):
|
||||
|
||||
Reference in New Issue
Block a user