mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: datasets related objects, apply filter and openapi spec (#10252)
* fix, datasets related objects, apply filter and openapi spec * fix, add 404 test * fix, add 404 test * fix test
This commit is contained in:
committed by
GitHub
parent
e5761d3cf7
commit
7ecff0e513
@@ -703,7 +703,6 @@ class TestDatasetApi(SupersetTestCase):
|
||||
def test_export_dataset(self):
|
||||
"""
|
||||
Dataset API: Test export dataset
|
||||
:return:
|
||||
"""
|
||||
birth_names_dataset = self.get_birth_names_dataset()
|
||||
|
||||
@@ -736,7 +735,6 @@ class TestDatasetApi(SupersetTestCase):
|
||||
def test_export_dataset_not_found(self):
|
||||
"""
|
||||
Dataset API: Test export dataset not found
|
||||
:return:
|
||||
"""
|
||||
max_id = db.session.query(func.max(SqlaTable.id)).scalar()
|
||||
# Just one does not exist and we get 404
|
||||
@@ -749,7 +747,6 @@ class TestDatasetApi(SupersetTestCase):
|
||||
def test_export_dataset_gamma(self):
|
||||
"""
|
||||
Dataset API: Test export dataset has gamma
|
||||
:return:
|
||||
"""
|
||||
birth_names_dataset = self.get_birth_names_dataset()
|
||||
|
||||
@@ -773,3 +770,21 @@ class TestDatasetApi(SupersetTestCase):
|
||||
response = json.loads(rv.data.decode("utf-8"))
|
||||
self.assertEqual(response["charts"]["count"], 18)
|
||||
self.assertEqual(response["dashboards"]["count"], 2)
|
||||
|
||||
def test_get_dataset_related_objects_not_found(self):
|
||||
"""
|
||||
Dataset API: Test related objects not found
|
||||
"""
|
||||
max_id = db.session.query(func.max(SqlaTable.id)).scalar()
|
||||
# id does not exist and we get 404
|
||||
invalid_id = max_id + 1
|
||||
uri = f"api/v1/dataset/{invalid_id}/related_objects/"
|
||||
self.login(username="admin")
|
||||
rv = self.client.get(uri)
|
||||
self.assertEqual(rv.status_code, 404)
|
||||
self.logout()
|
||||
self.login(username="gamma")
|
||||
table = self.get_birth_names_dataset()
|
||||
uri = f"api/v1/dataset/{table.id}/related_objects"
|
||||
rv = self.client.get(uri)
|
||||
self.assertEqual(rv.status_code, 404)
|
||||
|
||||
Reference in New Issue
Block a user