mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
test: fix flaky Python unit tests (#12253)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
"""Unit tests for Superset"""
|
||||
import json
|
||||
from io import BytesIO
|
||||
from unittest import mock
|
||||
from zipfile import is_zipfile, ZipFile
|
||||
|
||||
import prison
|
||||
@@ -343,6 +344,10 @@ class TestDatabaseApi(SupersetTestCase):
|
||||
"Invalid connection string", response["message"]["sqlalchemy_uri"][0],
|
||||
)
|
||||
|
||||
@mock.patch(
|
||||
"superset.views.core.app.config",
|
||||
{**app.config, "PREVENT_UNSAFE_DB_CONNECTIONS": True},
|
||||
)
|
||||
def test_create_database_fail_sqllite(self):
|
||||
"""
|
||||
Database API: Test create fail with sqllite
|
||||
@@ -493,6 +498,9 @@ class TestDatabaseApi(SupersetTestCase):
|
||||
"Invalid connection string", response["message"]["sqlalchemy_uri"][0],
|
||||
)
|
||||
|
||||
db.session.delete(test_database)
|
||||
db.session.commit()
|
||||
|
||||
def test_delete_database(self):
|
||||
"""
|
||||
Database API: Test delete
|
||||
@@ -830,6 +838,8 @@ class TestDatabaseApi(SupersetTestCase):
|
||||
}
|
||||
self.assertEqual(response, expected_response)
|
||||
|
||||
app.config["PREVENT_UNSAFE_DB_CONNECTIONS"] = False
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"load_unicode_dashboard_with_position", "load_energy_table_with_slice"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user