feat: welcome presto to the suite of tested databases (#10498)

* Add presto to the CI

Sample test data

Datetime conversion

Sample test data

Fix tests

* TODO to switch to timestamps

* Address feedback

* Update requirements

* Add TODOs

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
Bogdan
2020-08-06 12:07:22 -07:00
committed by GitHub
parent 749581d534
commit 62b873e3da
24 changed files with 440 additions and 104 deletions

View File

@@ -26,7 +26,7 @@ import tests.test_app
from superset import db, security_manager
from superset.connectors.sqla.models import SqlaTable
from superset.models.core import Database
from superset.utils.core import get_example_database
from superset.utils.core import get_example_database, get_main_database
from .base_tests import SupersetTestCase
@@ -179,7 +179,7 @@ class TestDatabaseApi(SupersetTestCase):
Database API: Test get select star with datasource access
"""
table = SqlaTable(
schema="main", table_name="ab_permission", database=get_example_database()
schema="main", table_name="ab_permission", database=get_main_database()
)
db.session.add(table)
db.session.commit()
@@ -191,14 +191,15 @@ class TestDatabaseApi(SupersetTestCase):
security_manager.add_permission_role(gamma_role, tmp_table_perm)
self.login(username="gamma")
example_db = get_example_database()
uri = f"api/v1/database/{example_db.id}/select_star/ab_permission/"
main_db = get_main_database()
uri = f"api/v1/database/{main_db.id}/select_star/ab_permission/"
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 200)
# rollback changes
security_manager.del_permission_role(gamma_role, tmp_table_perm)
db.session.delete(table)
db.session.delete(main_db)
db.session.commit()
def test_get_select_star_not_found_database(self):
@@ -222,7 +223,8 @@ class TestDatabaseApi(SupersetTestCase):
return
uri = f"api/v1/database/{example_db.id}/select_star/table_does_not_exist/"
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 404)
# TODO(bkyryliuk): investigate why presto returns 500
self.assertEqual(rv.status_code, 404 if example_db.backend != "presto" else 500)
def test_database_schemas(self):
"""