mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: complete theme management system import/export (#34850)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
c1a3606774
commit
4695be5cc5
@@ -239,7 +239,7 @@ class TestExportDashboardsCommand(SupersetTestCase):
|
||||
},
|
||||
"metadata": {"mock_key": "mock_value"},
|
||||
"version": "1.0.0",
|
||||
"theme_id": None,
|
||||
"theme_uuid": None,
|
||||
}
|
||||
|
||||
# @pytest.mark.usefixtures("load_covid_dashboard")
|
||||
@@ -318,8 +318,8 @@ class TestExportDashboardsCommand(SupersetTestCase):
|
||||
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
|
||||
@patch("superset.security.manager.g")
|
||||
@patch("superset.views.base.g")
|
||||
def test_export_dashboard_command_key_order(self, mock_g1, mock_g2):
|
||||
"""Test that they keys in the YAML have the same order as export_fields"""
|
||||
def test_export_dashboard_command_required_fields(self, mock_g1, mock_g2):
|
||||
"""Test that all required keys are present in the exported YAML"""
|
||||
mock_g1.user = security_manager.find_user("admin")
|
||||
mock_g2.user = security_manager.find_user("admin")
|
||||
|
||||
@@ -332,11 +332,11 @@ class TestExportDashboardsCommand(SupersetTestCase):
|
||||
metadata = yaml.safe_load(
|
||||
contents[f"dashboards/World_Banks_Data_{example_dashboard.id}.yaml"]()
|
||||
)
|
||||
assert list(metadata.keys()) == [
|
||||
assert set(metadata.keys()) == {
|
||||
"dashboard_title",
|
||||
"description",
|
||||
"css",
|
||||
"theme_id",
|
||||
"theme_uuid",
|
||||
"slug",
|
||||
"certified_by",
|
||||
"certification_details",
|
||||
@@ -345,7 +345,7 @@ class TestExportDashboardsCommand(SupersetTestCase):
|
||||
"position",
|
||||
"metadata",
|
||||
"version",
|
||||
]
|
||||
}
|
||||
|
||||
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
|
||||
@patch("superset.commands.dashboard.export.suffix")
|
||||
@@ -727,7 +727,7 @@ class TestImportDashboardsCommand(SupersetTestCase):
|
||||
command = v1.ImportDashboardsCommand(contents)
|
||||
with pytest.raises(CommandInvalidError) as excinfo:
|
||||
command.run()
|
||||
assert str(excinfo.value) == "Error importing dashboard"
|
||||
assert str(excinfo.value).startswith("Error importing dashboard")
|
||||
assert excinfo.value.normalized_messages() == {
|
||||
"metadata.yaml": {"type": ["Must be equal to Dashboard."]}
|
||||
}
|
||||
@@ -740,7 +740,7 @@ class TestImportDashboardsCommand(SupersetTestCase):
|
||||
command = v1.ImportDashboardsCommand(contents)
|
||||
with pytest.raises(CommandInvalidError) as excinfo:
|
||||
command.run()
|
||||
assert str(excinfo.value) == "Error importing dashboard"
|
||||
assert str(excinfo.value).startswith("Error importing dashboard")
|
||||
assert excinfo.value.normalized_messages() == {
|
||||
"datasets/imported_dataset.yaml": {
|
||||
"table_name": ["Missing data for required field."],
|
||||
|
||||
Reference in New Issue
Block a user