mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
fix(Presto): catch DatabaseError when testing Presto views (#25559)
Co-authored-by: Rui Zhao <zhaorui@dropbox.com>
This commit is contained in:
@@ -925,9 +925,11 @@ class TestPrestoDbEngineSpec(TestDbEngineSpec):
|
||||
def test_get_create_view_database_error(self):
|
||||
from pyhive.exc import DatabaseError
|
||||
|
||||
mock_execute = mock.MagicMock(side_effect=DatabaseError())
|
||||
mock_execute = mock.MagicMock()
|
||||
mock_fetch_data = mock.MagicMock(side_effect=DatabaseError())
|
||||
database = mock.MagicMock()
|
||||
database.get_raw_connection().__enter__().cursor().execute = mock_execute
|
||||
database.get_raw_connection().__enter__().cursor().fetchall = mock_fetch_data
|
||||
schema = "schema"
|
||||
table = "table"
|
||||
result = PrestoEngineSpec.get_create_view(database, schema=schema, table=table)
|
||||
|
||||
Reference in New Issue
Block a user