feat: add export_related flag (#19215)

* feat: add export_related flag

* Fix lint
This commit is contained in:
Beto Dealmeida
2022-03-16 16:03:06 -07:00
committed by GitHub
parent fc8721800b
commit d01fdad1d8
12 changed files with 196 additions and 67 deletions

View File

@@ -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):