From 2af630ffb5100cdf6d3e5213eba2cc948cb8d9fe Mon Sep 17 00:00:00 2001 From: Zef Lin Date: Tue, 10 May 2022 13:26:25 -0700 Subject: [PATCH] feat: deprecate /superset/testconn and migrate to api v1 (#20002) * feat: deprecate /superset/testconn and migrate to api v1 * bring back core_tests --- superset/templates/superset/models/database/macros.html | 2 +- superset/views/core.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/superset/templates/superset/models/database/macros.html b/superset/templates/superset/models/database/macros.html index ae67e4b78f728..f1d07220ef523 100644 --- a/superset/templates/superset/models/database/macros.html +++ b/superset/templates/superset/models/database/macros.html @@ -22,7 +22,7 @@ .append(''); $("#testconn").click(function(e) { e.preventDefault(); - var url = "/superset/testconn"; + var url = "/api/v1/database/test_connection"; var csrf_token = "{{ csrf_token() if csrf_token else '' }}"; $.ajaxSetup({ diff --git a/superset/views/core.py b/superset/views/core.py index 8fd50bb184e2b..5dc8b6e5abc79 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1333,6 +1333,11 @@ def add_slices( # pylint: disable=no-self-use @expose("/testconn", methods=["POST", "GET"]) def testconn(self) -> FlaskResponse: # pylint: disable=no-self-use """Tests a sqla connection""" + logger.warning( + "%s.testconn " + "This API endpoint is deprecated and will be removed in version 3.0.0", + self.__class__.__name__, + ) db_name = request.json.get("name") uri = request.json.get("uri") try: