fix: Allow dataset owners to see their datasets (#20135)

(cherry picked from commit b0c6935f06)
This commit is contained in:
cccs-tom
2022-05-25 04:58:15 -04:00
committed by Michael S. Molina
parent c5e2809c2c
commit 562e3a769b
2 changed files with 30 additions and 0 deletions

View File

@@ -213,6 +213,27 @@ class TestDatasetApi(SupersetTestCase):
response = json.loads(rv.data.decode("utf-8"))
assert response["result"] == []
def test_get_dataset_list_gamma_owned(self):
"""
Dataset API: Test get dataset list owned by gamma
"""
main_db = get_main_database()
owned_dataset = self.insert_dataset(
"ab_user", [self.get_user("gamma").id], main_db
)
self.login(username="gamma")
uri = "api/v1/dataset/"
rv = self.get_assert_metric(uri, "get_list")
assert rv.status_code == 200
response = json.loads(rv.data.decode("utf-8"))
assert response["count"] == 1
assert response["result"][0]["table_name"] == "ab_user"
db.session.delete(owned_dataset)
db.session.commit()
def test_get_dataset_related_database_gamma(self):
"""
Dataset API: Test get dataset related databases gamma