mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
feat: create base class for export commands (#11463)
* Add UUID to saved_query * Reuse function from previous migration * Point to new head * feat: add backend to export saved queries using new format * Rename ImportMixin to ImportExportMixin * Create base class for exports * Add saved queries as well * Add constant, small fixes * Fix wrong import * Fix lint
This commit is contained in:
@@ -32,12 +32,13 @@ class TestExportDatabasesCommand(SupersetTestCase):
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
|
||||
example_db = get_example_database()
|
||||
command = ExportDatabasesCommand(database_ids=[example_db.id])
|
||||
command = ExportDatabasesCommand([example_db.id])
|
||||
contents = dict(command.run())
|
||||
|
||||
# TODO: this list shouldn't depend on the order in which unit tests are run
|
||||
# or on the backend; for now use a stable subset
|
||||
core_files = {
|
||||
"metadata.yaml",
|
||||
"databases/examples.yaml",
|
||||
"datasets/examples/energy_usage.yaml",
|
||||
"datasets/examples/wb_health_population.yaml",
|
||||
@@ -227,7 +228,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
|
||||
mock_g.user = security_manager.find_user("gamma")
|
||||
|
||||
example_db = get_example_database()
|
||||
command = ExportDatabasesCommand(database_ids=[example_db.id])
|
||||
command = ExportDatabasesCommand([example_db.id])
|
||||
contents = command.run()
|
||||
with self.assertRaises(DatabaseNotFoundError):
|
||||
next(contents)
|
||||
@@ -236,7 +237,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
|
||||
def test_export_database_command_invalid_database(self, mock_g):
|
||||
"""Test that an error is raised when exporting an invalid database"""
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
command = ExportDatabasesCommand(database_ids=[-1])
|
||||
command = ExportDatabasesCommand([-1])
|
||||
contents = command.run()
|
||||
with self.assertRaises(DatabaseNotFoundError):
|
||||
next(contents)
|
||||
@@ -247,7 +248,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
|
||||
example_db = get_example_database()
|
||||
command = ExportDatabasesCommand(database_ids=[example_db.id])
|
||||
command = ExportDatabasesCommand([example_db.id])
|
||||
contents = dict(command.run())
|
||||
|
||||
metadata = yaml.safe_load(contents["databases/examples.yaml"])
|
||||
|
||||
Reference in New Issue
Block a user