From adb701037d3079eeeb72efacb9a15b4f53cd381a Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Thu, 21 Mar 2024 16:56:49 +0100 Subject: [PATCH] Add ut --- tests/integration_tests/core_tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/integration_tests/core_tests.py b/tests/integration_tests/core_tests.py index ceb2bf778290b..3d25790f266a9 100644 --- a/tests/integration_tests/core_tests.py +++ b/tests/integration_tests/core_tests.py @@ -1185,6 +1185,21 @@ def test_has_table_by_name(self): is True ) + @mock.patch("superset.views.core.request") + @mock.patch( + "superset.commands.dashboard.permalink.get.GetDashboardPermalinkCommand.run" + ) + def test_dashboard_permalink(self, get_dashboard_permalink_mock, request_mock): + request_mock.query_string = b"standalone=3" + get_dashboard_permalink_mock.return_value = {"dashboardId": 1} + self.login() + resp = self.client.get("superset/dashboard/p/123/") + + expected_url = "/superset/dashboard/1?permalink_key=123&standalone=3" + + self.assertEqual(resp.headers["Location"], expected_url) + assert resp.status_code == 302 + if __name__ == "__main__": unittest.main()