feat: deprecate /superset/testconn and migrate to api v1 (#20002)

* feat: deprecate /superset/testconn and migrate to api v1

* bring back core_tests
This commit is contained in:
Zef Lin 2022-05-10 13:26:25 -07:00 committed by GitHub
parent 87a4379d0a
commit 7b7de9592b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,7 @@
.append('<button id="testconn" class="btn btn-sm btn-primary">{{ _("Test Connection") }}</button>');
$("#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({

View File

@ -1333,6 +1333,11 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
@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: