Fix for Python httpx test failure, refs #2066

This commit is contained in:
Simon Willison 2023-04-26 21:20:38 -07:00
commit 917272c864

View file

@ -5,6 +5,7 @@ from .fixtures import ( # noqa
app_client_with_cors, app_client_with_cors,
app_client_with_trace, app_client_with_trace,
) )
import urllib.parse
EXPECTED_TABLE_CSV = """id,content EXPECTED_TABLE_CSV = """id,content
1,hello 1,hello
@ -142,11 +143,24 @@ def test_csv_with_non_ascii_characters(app_client):
def test_max_csv_mb(app_client_csv_max_mb_one): def test_max_csv_mb(app_client_csv_max_mb_one):
# This query deliberately generates a really long string
# should be 100*100*100*2 = roughly 2MB
response = app_client_csv_max_mb_one.get( response = app_client_csv_max_mb_one.get(
( "/fixtures.csv?"
"/fixtures.csv?sql=select+'{}'+" + urllib.parse.urlencode(
"from+compound_three_primary_keys&_stream=1&_size=max" {
).format("abcdefg" * 10000) "sql": """
select group_concat('ab', '')
from json_each(json_array({lots})),
json_each(json_array({lots})),
json_each(json_array({lots}))
""".format(
lots=", ".join(str(i) for i in range(100))
),
"_stream": 1,
"_size": "max",
}
),
) )
# It's a 200 because we started streaming before we knew the error # It's a 200 because we started streaming before we knew the error
assert response.status == 200 assert response.status == 200