mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Added /-/limits and /-/limits.json, closes #270
This commit is contained in:
parent
08f4b7658f
commit
39426ff0e4
2 changed files with 18 additions and 0 deletions
|
|
@ -442,6 +442,10 @@ class Datasette:
|
||||||
JsonDataView.as_view(self, "plugins.json", self.plugins),
|
JsonDataView.as_view(self, "plugins.json", self.plugins),
|
||||||
"/-/plugins<as_json:(\.json)?$>",
|
"/-/plugins<as_json:(\.json)?$>",
|
||||||
)
|
)
|
||||||
|
app.add_route(
|
||||||
|
JsonDataView.as_view(self, "limits.json", lambda: self.limits),
|
||||||
|
"/-/limits<as_json:(\.json)?$>",
|
||||||
|
)
|
||||||
app.add_route(
|
app.add_route(
|
||||||
DatabaseView.as_view(self), "/<db_name:[^/\.]+?><as_json:(\.jsono?)?$>"
|
DatabaseView.as_view(self), "/<db_name:[^/\.]+?><as_json:(\.jsono?)?$>"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -897,6 +897,20 @@ def test_versions_json(app_client):
|
||||||
assert 'fts_versions' in response.json['sqlite']
|
assert 'fts_versions' in response.json['sqlite']
|
||||||
|
|
||||||
|
|
||||||
|
def test_limits_json(app_client):
|
||||||
|
response = app_client.get(
|
||||||
|
"/-/limits.json",
|
||||||
|
gather_request=False
|
||||||
|
)
|
||||||
|
assert {
|
||||||
|
"default_facet_size": 30,
|
||||||
|
"facet_suggest_time_limit_ms": 50,
|
||||||
|
"facet_time_limit_ms": 200,
|
||||||
|
"max_returned_rows": 100,
|
||||||
|
"sql_time_limit_ms": 200,
|
||||||
|
} == response.json
|
||||||
|
|
||||||
|
|
||||||
def test_page_size_matching_max_returned_rows(app_client_returend_rows_matches_page_size):
|
def test_page_size_matching_max_returned_rows(app_client_returend_rows_matches_page_size):
|
||||||
fetched = []
|
fetched = []
|
||||||
path = '/test_tables/no_primary_key.json'
|
path = '/test_tables/no_primary_key.json'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue