feat: security, user group support (#32121)

This commit is contained in:
Daniel Vaz Gaspar
2025-03-04 09:54:12 +00:00
committed by GitHub
parent fe33661821
commit 15cf06699a
10 changed files with 193 additions and 17 deletions

View File

@@ -80,6 +80,9 @@ from tests.integration_tests.fixtures.unicode_dashboard import (
load_unicode_dashboard_with_position, # noqa: F401
load_unicode_data, # noqa: F401
)
from tests.integration_tests.fixtures.users import (
create_gamma_user_group_with_all_database, # noqa: F401
)
from tests.integration_tests.test_app import app
@@ -261,6 +264,18 @@ class TestDatabaseApi(SupersetTestCase):
response = json.loads(rv.data.decode("utf-8"))
assert response["count"] == 0
@pytest.mark.usefixtures("create_gamma_user_group_with_all_database")
def test_get_items_gamma_group(self):
"""
Database API: Test get items gamma with group
"""
self.login("gamma_with_groups", "password1")
uri = "api/v1/database/"
rv = self.client.get(uri)
assert rv.status_code == 200
response = json.loads(rv.data.decode("utf-8"))
assert response["count"] > 0
def test_create_database(self):
"""
Database API: Test create
@@ -2360,6 +2375,17 @@ class TestDatabaseApi(SupersetTestCase):
rv = self.get_assert_metric(uri, "related_objects")
assert rv.status_code == 404
@pytest.mark.usefixtures("create_gamma_user_group_with_all_database")
def test_get_database_related_objects_gamma_group(self):
"""
Database API: Test related objects with gamma group with role all database
"""
database = get_example_database()
self.login("gamma_with_groups", "password1")
uri = f"api/v1/database/{database.id}/related_objects/"
rv = self.get_assert_metric(uri, "related_objects")
assert rv.status_code == 200
def test_export_database(self):
"""
Database API: Test export database