mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
feat: Persist default folders location when repositioned in folders editor (#38105)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
8c58b998b1
commit
660357c76b
@@ -29,7 +29,12 @@ from superset.commands.dataset.exceptions import (
|
||||
DatasetNotFoundError,
|
||||
MultiCatalogDisabledValidationError,
|
||||
)
|
||||
from superset.commands.dataset.update import UpdateDatasetCommand, validate_folders
|
||||
from superset.commands.dataset.update import (
|
||||
DEFAULT_COLUMNS_FOLDER_UUID,
|
||||
DEFAULT_METRICS_FOLDER_UUID,
|
||||
UpdateDatasetCommand,
|
||||
validate_folders,
|
||||
)
|
||||
from superset.commands.exceptions import OwnersNotFoundValidationError
|
||||
from superset.datasets.schemas import FolderSchema
|
||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||
@@ -564,6 +569,34 @@ def test_validate_folders_invalid_names(mocker: MockerFixture) -> None:
|
||||
assert str(excinfo.value) == "Folder cannot have name 'Columns'"
|
||||
|
||||
|
||||
@with_feature_flags(DATASET_FOLDERS=True)
|
||||
def test_validate_folders_allows_default_folders(mocker: MockerFixture) -> None:
|
||||
"""
|
||||
Test that default system folders (Metrics/Columns) are allowed when using
|
||||
the well-known default folder UUIDs, so their position can be persisted.
|
||||
"""
|
||||
folders = cast(
|
||||
list[FolderSchema],
|
||||
[
|
||||
{
|
||||
"uuid": DEFAULT_METRICS_FOLDER_UUID,
|
||||
"type": "folder",
|
||||
"name": "Metrics",
|
||||
"children": [],
|
||||
},
|
||||
{
|
||||
"uuid": DEFAULT_COLUMNS_FOLDER_UUID,
|
||||
"type": "folder",
|
||||
"name": "Columns",
|
||||
"children": [],
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
# Should not raise - default folders are allowed to use reserved names
|
||||
validate_folders(folders=folders, valid_uuids=set())
|
||||
|
||||
|
||||
@with_feature_flags(DATASET_FOLDERS=True)
|
||||
def test_validate_folders_invalid_uuid(mocker: MockerFixture) -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user