Fixes #3134 by correct response content-type of /testconn (#3135)

This commit is contained in:
Ke Zhu 2017-07-15 12:52:38 -04:00 committed by Maxime Beauchemin
parent 256a521bf1
commit e834154030
2 changed files with 3 additions and 1 deletions

View File

@ -1374,7 +1374,7 @@ class Superset(BaseSupersetView):
.get('connect_args', {}))
engine = create_engine(uri, connect_args=connect_args)
engine.connect()
return json.dumps(engine.table_names(), indent=4)
return json_success(json.dumps(engine.table_names(), indent=4))
except Exception as e:
logging.exception(e)
return json_error_response((

View File

@ -284,6 +284,7 @@ class CoreTests(SupersetTestCase):
})
response = self.client.post('/superset/testconn', data=data, content_type='application/json')
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/json'
# validate that the endpoint works with the decrypted sqlalchemy uri
data = json.dumps({
@ -292,6 +293,7 @@ class CoreTests(SupersetTestCase):
})
response = self.client.post('/superset/testconn', data=data, content_type='application/json')
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/json'
def test_databaseview_edit(self, username='admin'):
# validate that sending a password-masked uri does not over-write the decrypted uri