mikebridge commented on code in PR #40129: URL: https://github.com/apache/superset/pull/40129#discussion_r3501576598
########## tests/unit_tests/dao/dashboard_test.py: ########## @@ -0,0 +1,95 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from datetime import datetime, timezone +from typing import Any + +from sqlalchemy.orm.session import Session + + +def test_set_dash_metadata_preserves_soft_deleted_members( + session: Session, +) -> None: + """Saving a dashboard must not sever a soft-deleted member chart. + + ``set_dash_metadata`` rebuilds ``dashboard.slices`` wholesale from the + incoming position data. The slice-resolution query must bypass the + soft-delete visibility filter: with the filter active, a member chart + sitting in the trash would be silently dropped from the assignment — + deleting its ``dashboard_slices`` junction row (breaking the + restore-reattach contract) and writing ``uuid: None`` into its + position slot. This test fails if the bypass is removed. + """ + from superset import db + from superset.connectors.sqla.models import Database, SqlaTable + from superset.daos.dashboard import DashboardDAO + from superset.models.dashboard import Dashboard + from superset.models.slice import Slice Review Comment: Fixed in f4d446a8a2 — moved all five `from superset...` imports to the module-level import block and removed the inline copies. ruff/mypy clean, test passes. _— posted by Claude (AI agent) on behalf of @mikebridge_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
