Skip to content

Commit

Permalink
feat: deprecate /superset/testconn and migrate to api v1 (#20002)
Browse files Browse the repository at this point in the history
* feat: deprecate /superset/testconn and migrate to api v1

* bring back core_tests
  • Loading branch information
Zef Lin committed May 10, 2022
1 parent 87a4379 commit 7b7de95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superset/templates/superset/models/database/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 5 additions & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7b7de95

Please sign in to comment.