mirror of
https://github.com/apache/superset.git
synced 2026-04-07 18:35:15 +00:00
chore: Bump flask libs (#22355)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user