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:
@@ -176,6 +176,26 @@ class TestExportChartsCommand(SupersetTestCase):
|
||||
"dataset_uuid",
|
||||
]
|
||||
|
||||
@patch("superset.security.manager.g")
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice")
|
||||
def test_export_chart_command_no_related(self, mock_g):
|
||||
"""
|
||||
Test that only the chart is exported when export_related=False.
|
||||
"""
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
|
||||
example_chart = (
|
||||
db.session.query(Slice).filter_by(slice_name="Energy Sankey").one()
|
||||
)
|
||||
command = ExportChartsCommand([example_chart.id], export_related=False)
|
||||
contents = dict(command.run())
|
||||
|
||||
expected = [
|
||||
"metadata.yaml",
|
||||
f"charts/Energy_Sankey_{example_chart.id}.yaml",
|
||||
]
|
||||
assert expected == list(contents.keys())
|
||||
|
||||
|
||||
class TestImportChartsCommand(SupersetTestCase):
|
||||
@patch("superset.charts.commands.importers.v1.utils.g")
|
||||
|
||||
Reference in New Issue
Block a user