codeant-ai-for-open-source[bot] commented on code in PR #38584:
URL: https://github.com/apache/superset/pull/38584#discussion_r3662399420
##########
tests/integration_tests/charts/commands_tests.py:
##########
@@ -669,6 +716,45 @@ def test_update_chart_dashboard_security_admin_bypass(
db.session.delete(alpha_dashboard)
db.session.commit()
+ @patch("superset.commands.chart.update.g")
+ @patch("superset.utils.core.g")
+ @patch("superset.security.manager.g")
+ @pytest.mark.usefixtures("load_energy_table_with_slice")
+ def test_update_chart_rejects_new_externally_managed_dashboard(
+ self, mock_sm_g, mock_u_g, mock_c_g
+ ):
+ """Test that updating a chart to add an externally managed dashboard
fails"""
+ from superset.models.dashboard import Dashboard
+
+ admin = security_manager.find_user(username="admin")
+ mock_u_g.user = mock_c_g.user = mock_sm_g.user = admin
+
+ chart = db.session.query(Slice).first()
+ chart.owners = [admin]
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> For test classes that already contain multiple shared-fixture mutations,
prefer tracking cleanup consistently across the whole class rather than
flagging a single mutation in isolation.
**Applied to:**
- `**/test/**`
- `**/tests/**`
- `**/*test*.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]