mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
refactor: Removes the legacy dataset editor (#31976)
This commit is contained in:
committed by
GitHub
parent
6eb87e04c0
commit
687f762457
@@ -52,7 +52,6 @@ from superset.sql_parse import Table
|
||||
from superset.utils import core as utils, json
|
||||
from superset.utils.core import backend
|
||||
from superset.utils.database import get_example_database
|
||||
from superset.views.database.views import DatabaseView
|
||||
from tests.integration_tests.constants import ADMIN_USERNAME, GAMMA_USERNAME
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import (
|
||||
load_birth_names_dashboard_with_slices, # noqa: F401
|
||||
@@ -270,13 +269,6 @@ class TestCore(SupersetTestCase):
|
||||
resp = self.client.get(url)
|
||||
assert resp.status_code == 200
|
||||
|
||||
def test_get_user_slices(self):
|
||||
self.login(ADMIN_USERNAME)
|
||||
userid = security_manager.find_user("admin").id
|
||||
url = f"/sliceasync/api/read?_flt_0_created_by={userid}"
|
||||
resp = self.client.get(url)
|
||||
assert resp.status_code == 200
|
||||
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice")
|
||||
def test_slices_V2(self): # noqa: N802
|
||||
# Add explore-v2-beta role to admin user
|
||||
@@ -328,25 +320,6 @@ class TestCore(SupersetTestCase):
|
||||
# Disable for password store for later tests
|
||||
models.custom_password_store = None
|
||||
|
||||
def test_databaseview_edit(self):
|
||||
# validate that sending a password-masked uri does not over-write the decrypted
|
||||
# uri
|
||||
self.login(ADMIN_USERNAME)
|
||||
database = superset.utils.database.get_example_database()
|
||||
sqlalchemy_uri_decrypted = database.sqlalchemy_uri_decrypted
|
||||
url = f"databaseview/edit/{database.id}"
|
||||
data = {k: database.__getattribute__(k) for k in DatabaseView.add_columns}
|
||||
data["sqlalchemy_uri"] = database.safe_sqlalchemy_uri()
|
||||
self.client.post(url, data=data)
|
||||
database = superset.utils.database.get_example_database()
|
||||
assert sqlalchemy_uri_decrypted == database.sqlalchemy_uri_decrypted
|
||||
|
||||
# Need to clean up after ourselves
|
||||
database.impersonate_user = False
|
||||
database.allow_dml = False
|
||||
database.allow_run_async = False
|
||||
db.session.commit()
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_warm_up_cache_error(self) -> None:
|
||||
self.login(ADMIN_USERNAME)
|
||||
|
||||
@@ -1818,35 +1818,6 @@ class TestDatabaseApi(SupersetTestCase):
|
||||
db.session.delete(database)
|
||||
db.session.commit()
|
||||
|
||||
def mock_empty_csv_function(d, user): # noqa: N805
|
||||
return []
|
||||
|
||||
@mock.patch(
|
||||
"superset.views.core.app.config",
|
||||
{**app.config, "ALLOWED_USER_CSV_SCHEMA_FUNC": mock_empty_csv_function},
|
||||
)
|
||||
def test_get_allow_file_upload_false_csv(self):
|
||||
"""
|
||||
Database API: Test filter for allow file upload checks for schemas.
|
||||
Both databases have false allow_file_upload
|
||||
"""
|
||||
with self.create_app().app_context():
|
||||
self.login(ADMIN_USERNAME)
|
||||
arguments = {
|
||||
"columns": ["allow_file_upload"],
|
||||
"filters": [
|
||||
{
|
||||
"col": "allow_file_upload",
|
||||
"opr": "upload_is_enabled",
|
||||
"value": True,
|
||||
}
|
||||
],
|
||||
}
|
||||
uri = f"api/v1/database/?q={prison.dumps(arguments)}"
|
||||
rv = self.client.get(uri)
|
||||
data = json.loads(rv.data.decode("utf-8"))
|
||||
assert data["count"] == 1
|
||||
|
||||
def test_get_allow_file_upload_filter_no_permission(self):
|
||||
"""
|
||||
Database API: Test filter for allow file upload checks for schemas
|
||||
|
||||
@@ -27,7 +27,6 @@ from superset import db
|
||||
|
||||
from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
|
||||
from superset.utils.database import get_example_database
|
||||
from superset.utils.dict_import_export import export_to_dict
|
||||
from superset.utils import json
|
||||
|
||||
from .base_tests import SupersetTestCase
|
||||
@@ -248,28 +247,6 @@ class TestDictImportExport(SupersetTestCase):
|
||||
imported_copy_table.export_to_dict(), imported_table.export_to_dict()
|
||||
)
|
||||
|
||||
def test_export_datasource_ui_cli(self):
|
||||
# TODO(bkyryliuk): find fake db is leaking from
|
||||
self.delete_fake_db()
|
||||
|
||||
cli_export = export_to_dict(
|
||||
recursive=True,
|
||||
back_references=False,
|
||||
include_defaults=False,
|
||||
)
|
||||
self.get_resp("/login/", data=dict(username="admin", password="general")) # noqa: S106, C408
|
||||
resp = self.get_resp(
|
||||
"/databaseview/action_post", {"action": "yaml_export", "rowid": 1}
|
||||
)
|
||||
ui_export = yaml.safe_load(resp)
|
||||
assert (
|
||||
ui_export["databases"][0]["database_name"]
|
||||
== cli_export["databases"][0]["database_name"]
|
||||
)
|
||||
assert (
|
||||
ui_export["databases"][0]["tables"] == cli_export["databases"][0]["tables"]
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user