mirror of
https://github.com/apache/superset.git
synced 2026-04-24 10:35:01 +00:00
fix: create permissions on DB import (#29802)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from typing import Optional
|
||||
from unittest.mock import patch
|
||||
from zipfile import is_zipfile, ZipFile
|
||||
|
||||
import yaml
|
||||
@@ -898,7 +899,8 @@ class TestSavedQueryApi(SupersetTestCase):
|
||||
buf.seek(0)
|
||||
return buf
|
||||
|
||||
def test_import_saved_queries(self):
|
||||
@patch("superset.commands.database.importers.v1.utils.add_permissions")
|
||||
def test_import_saved_queries(self, mock_add_permissions):
|
||||
"""
|
||||
Saved Query API: Test import
|
||||
"""
|
||||
|
||||
@@ -148,7 +148,8 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
|
||||
|
||||
class TestImportSavedQueriesCommand(SupersetTestCase):
|
||||
@patch("superset.security.manager.g")
|
||||
def test_import_v1_saved_queries(self, mock_g):
|
||||
@patch("superset.commands.database.importers.v1.utils.add_permissions")
|
||||
def test_import_v1_saved_queries(self, mock_add_permissions, mock_g):
|
||||
"""Test that we can import a saved query"""
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
|
||||
@@ -178,7 +179,8 @@ class TestImportSavedQueriesCommand(SupersetTestCase):
|
||||
db.session.commit()
|
||||
|
||||
@patch("superset.security.manager.g")
|
||||
def test_import_v1_saved_queries_multiple(self, mock_g):
|
||||
@patch("superset.commands.database.importers.v1.utils.add_permissions")
|
||||
def test_import_v1_saved_queries_multiple(self, mock_add_permissions, mock_g):
|
||||
"""Test that a saved query can be imported multiple times"""
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user