fix: Ensure consistent naming for testconn (#11246)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley 2020-10-13 09:53:03 -07:00 committed by GitHub
parent 88af85ac53
commit 51fec1ab16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -41,12 +41,12 @@
uri: $.trim($("#sqlalchemy_uri").val()),
name: $('#database_name').val(),
impersonate_user: $('#impersonate_user').is(':checked'),
extras: extra ? JSON.parse(extra) : {},
extra: extra ? JSON.parse(extra) : {},
encrypted_extra: encryptedExtra ? JSON.parse(encryptedExtra) : {},
server_cert: $("#server_cert").val(),
})
} catch(parse_error){
alert("Malformed JSON in the extras field: " + parse_error);
alert("Malformed JSON in the extra fields: " + parse_error);
return false
}

View File

@ -1135,12 +1135,11 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
if existing_database and uri == existing_database.safe_sqlalchemy_uri():
uri = existing_database.sqlalchemy_uri_decrypted
# this is the database instance that will be tested
# This is the database instance that will be tested. Note the extra fields
# are represented as JSON encoded strings in the model.
database = models.Database(
# extras is sent as json, but required to be a string in the Database
# model
server_cert=request.json.get("server_cert"),
extra=json.dumps(request.json.get("extras", {})),
extra=json.dumps(request.json.get("extra", {})),
impersonate_user=request.json.get("impersonate_user"),
encrypted_extra=json.dumps(request.json.get("encrypted_extra", {})),
)