mirror of
https://github.com/apache/superset.git
synced 2026-04-28 12:34:23 +00:00
chore: Bump flask libs (#22355)
This commit is contained in:
@@ -188,7 +188,11 @@ def example_db_provider() -> Callable[[], Database]: # type: ignore
|
||||
|
||||
|
||||
def setup_presto_if_needed():
|
||||
backend = app.config["SQLALCHEMY_EXAMPLES_URI"].split("://")[0]
|
||||
db_uri = (
|
||||
app.config.get("SQLALCHEMY_EXAMPLES_URI")
|
||||
or app.config["SQLALCHEMY_DATABASE_URI"]
|
||||
)
|
||||
backend = db_uri.split("://")[0]
|
||||
database = get_example_database()
|
||||
extra = database.get_extra()
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ class TestCore(SupersetTestCase):
|
||||
|
||||
self.login(username="admin")
|
||||
response = self.client.get(f"/r/{model_url.id}")
|
||||
assert response.headers["Location"] == "http://localhost/"
|
||||
assert response.headers["Location"] == "/"
|
||||
db.session.delete(model_url)
|
||||
db.session.commit()
|
||||
|
||||
@@ -1674,7 +1674,9 @@ class TestCore(SupersetTestCase):
|
||||
rv = self.client.get(
|
||||
f"/superset/explore/?form_data={quote(json.dumps(form_data))}"
|
||||
)
|
||||
self.assertRedirects(rv, f"/explore/?form_data_key={random_key}")
|
||||
self.assertEqual(
|
||||
rv.headers["Location"], f"/explore/?form_data_key={random_key}"
|
||||
)
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_has_table_by_name(self):
|
||||
|
||||
@@ -143,7 +143,7 @@ class TestDashboard(SupersetTestCase):
|
||||
dash_count_after = db.session.query(func.count(Dashboard.id)).first()[0]
|
||||
self.assertEqual(dash_count_before + 1, dash_count_after)
|
||||
group = re.match(
|
||||
r"http:\/\/localhost\/superset\/dashboard\/([0-9]*)\/\?edit=true",
|
||||
r"\/superset\/dashboard\/([0-9]*)\/\?edit=true",
|
||||
response.headers["Location"],
|
||||
)
|
||||
assert group is not None
|
||||
|
||||
@@ -466,9 +466,9 @@ def test_get_samples(test_client, login_as_admin, virtual_dataset):
|
||||
f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table"
|
||||
)
|
||||
# feeds data
|
||||
test_client.post(uri)
|
||||
test_client.post(uri, json={})
|
||||
# get from cache
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 200
|
||||
assert len(rv.json["result"]["data"]) == 10
|
||||
assert QueryCacheManager.has(
|
||||
@@ -480,9 +480,9 @@ def test_get_samples(test_client, login_as_admin, virtual_dataset):
|
||||
# 2. should read through cache data
|
||||
uri2 = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&force=true"
|
||||
# feeds data
|
||||
test_client.post(uri2)
|
||||
test_client.post(uri2, json={})
|
||||
# force query
|
||||
rv2 = test_client.post(uri2)
|
||||
rv2 = test_client.post(uri2, json={})
|
||||
assert rv2.status_code == 200
|
||||
assert len(rv2.json["result"]["data"]) == 10
|
||||
assert QueryCacheManager.has(
|
||||
@@ -518,7 +518,7 @@ def test_get_samples_with_incorrect_cc(test_client, login_as_admin, virtual_data
|
||||
uri = (
|
||||
f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table"
|
||||
)
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 422
|
||||
|
||||
assert "error" in rv.json
|
||||
@@ -530,7 +530,7 @@ def test_get_samples_on_physical_dataset(test_client, login_as_admin, physical_d
|
||||
uri = (
|
||||
f"/datasource/samples?datasource_id={physical_dataset.id}&datasource_type=table"
|
||||
)
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 200
|
||||
assert QueryCacheManager.has(
|
||||
rv.json["result"]["cache_key"], region=CacheRegion.DATA
|
||||
@@ -543,7 +543,7 @@ def test_get_samples_with_filters(test_client, login_as_admin, virtual_dataset):
|
||||
f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table"
|
||||
)
|
||||
rv = test_client.post(uri, json=None)
|
||||
assert rv.status_code == 200
|
||||
assert rv.status_code == 400
|
||||
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 200
|
||||
@@ -644,7 +644,7 @@ def test_get_samples_pagination(test_client, login_as_admin, virtual_dataset):
|
||||
uri = (
|
||||
f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table"
|
||||
)
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.json["result"]["page"] == 1
|
||||
assert rv.json["result"]["per_page"] == app.config["SAMPLES_ROW_LIMIT"]
|
||||
assert rv.json["result"]["total_count"] == 10
|
||||
@@ -653,28 +653,28 @@ def test_get_samples_pagination(test_client, login_as_admin, virtual_dataset):
|
||||
per_pages = (app.config["SAMPLES_ROW_LIMIT"] + 1, 0, "xx")
|
||||
for per_page in per_pages:
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&per_page={per_page}"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 400
|
||||
|
||||
# 3. incorrect page or datasource_type
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&page=xx"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 400
|
||||
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=xx"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.status_code == 400
|
||||
|
||||
# 4. turning pages
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&per_page=2&page=1"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.json["result"]["page"] == 1
|
||||
assert rv.json["result"]["per_page"] == 2
|
||||
assert rv.json["result"]["total_count"] == 10
|
||||
assert [row["col1"] for row in rv.json["result"]["data"]] == [0, 1]
|
||||
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&per_page=2&page=2"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.json["result"]["page"] == 2
|
||||
assert rv.json["result"]["per_page"] == 2
|
||||
assert rv.json["result"]["total_count"] == 10
|
||||
@@ -682,7 +682,7 @@ def test_get_samples_pagination(test_client, login_as_admin, virtual_dataset):
|
||||
|
||||
# 5. Exceeding the maximum pages
|
||||
uri = f"/datasource/samples?datasource_id={virtual_dataset.id}&datasource_type=table&per_page=2&page=6"
|
||||
rv = test_client.post(uri)
|
||||
rv = test_client.post(uri, json={})
|
||||
assert rv.json["result"]["page"] == 6
|
||||
assert rv.json["result"]["per_page"] == 2
|
||||
assert rv.json["result"]["total_count"] == 10
|
||||
|
||||
@@ -368,7 +368,7 @@ class TestThumbnails(SupersetTestCase):
|
||||
id_, thumbnail_url = self._get_id_and_thumbnail_url(CHART_URL)
|
||||
rv = self.client.get(f"api/v1/chart/{id_}/thumbnail/1234/")
|
||||
self.assertEqual(rv.status_code, 302)
|
||||
self.assertRedirects(rv, thumbnail_url)
|
||||
self.assertEqual(rv.headers["Location"], thumbnail_url)
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
@with_feature_flags(THUMBNAILS=True)
|
||||
@@ -413,4 +413,4 @@ class TestThumbnails(SupersetTestCase):
|
||||
id_, thumbnail_url = self._get_id_and_thumbnail_url(DASHBOARD_URL)
|
||||
rv = self.client.get(f"api/v1/dashboard/{id_}/thumbnail/1234/")
|
||||
self.assertEqual(rv.status_code, 302)
|
||||
self.assertRedirects(rv, thumbnail_url)
|
||||
self.assertEqual(rv.headers["Location"], thumbnail_url)
|
||||
|
||||
Reference in New Issue
Block a user