mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
Do not show stacktraces on some intentionally-thrown errors (#9056)
* Do not show stacktraces on some intentionally-thrown errors * Fix pylint error * Fix JavaScript looking for the wrong key in error response from connection check * format -> f-string * Run black because PyCharm missed it on the last save
This commit is contained in:
@@ -418,6 +418,26 @@ class CoreTests(SupersetTestCase):
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
|
||||
def test_testconn_failed_conn(self, username="admin"):
|
||||
self.login(username=username)
|
||||
|
||||
data = json.dumps(
|
||||
{"uri": "broken://url", "name": "examples", "impersonate_user": False}
|
||||
)
|
||||
response = self.client.post(
|
||||
"/superset/testconn", data=data, content_type="application/json"
|
||||
)
|
||||
assert response.status_code == 400
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
response_body = json.loads(response.data.decode("utf-8"))
|
||||
expected_body = {
|
||||
"error": "Connection failed!\n\nThe error message returned was:\nCan't load plugin: sqlalchemy.dialects:broken"
|
||||
}
|
||||
assert response_body == expected_body, "%s != %s" % (
|
||||
response_body,
|
||||
expected_body,
|
||||
)
|
||||
|
||||
def test_custom_password_store(self):
|
||||
database = utils.get_example_database()
|
||||
conn_pre = sqla.engine.url.make_url(database.sqlalchemy_uri_decrypted)
|
||||
|
||||
Reference in New Issue
Block a user