feat: add export_related flag (#19215)

* feat: add export_related flag

* Fix lint
This commit is contained in:
Beto Dealmeida
2022-03-16 16:03:06 -07:00
committed by GitHub
parent fc8721800b
commit d01fdad1d8
12 changed files with 196 additions and 67 deletions

View File

@@ -83,6 +83,24 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
"database_uuid": str(self.example_database.uuid),
}
@patch("superset.queries.saved_queries.filters.g")
def test_export_query_command_no_related(self, mock_g):
"""
Test that only the query is exported when export_related=False.
"""
mock_g.user = security_manager.find_user("admin")
command = ExportSavedQueriesCommand(
[self.example_query.id], export_related=False
)
contents = dict(command.run())
expected = [
"metadata.yaml",
"queries/examples/schema1/The_answer.yaml",
]
assert expected == list(contents.keys())
@patch("superset.queries.saved_queries.filters.g")
def test_export_query_command_no_access(self, mock_g):
"""Test that users can't export datasets they don't have access to"""