mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New JSON design for query views (#2118)
* Refs #2111, closes #2110 * New Context dataclass/subclass mechanism, refs #2127 * Define QueryContext and extract get_tables() method, refs #2127 * Fix OPTIONS bug by porting DaatbaseView to be a View subclass * Expose async_view_for_class.view_class for test_routes test * Error/truncated aruments for renderers, closes #2130
This commit is contained in:
parent
5139c0886a
commit
1377a290cd
15 changed files with 579 additions and 112 deletions
|
|
@ -248,6 +248,9 @@ async def test_css_classes_on_body(ds_client, path, expected_classes):
|
|||
assert classes == expected_classes
|
||||
|
||||
|
||||
templates_considered_re = re.compile(r"<!-- Templates considered: (.*?) -->")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"path,expected_considered",
|
||||
|
|
@ -271,7 +274,10 @@ async def test_css_classes_on_body(ds_client, path, expected_classes):
|
|||
async def test_templates_considered(ds_client, path, expected_considered):
|
||||
response = await ds_client.get(path)
|
||||
assert response.status_code == 200
|
||||
assert f"<!-- Templates considered: {expected_considered} -->" in response.text
|
||||
match = templates_considered_re.search(response.text)
|
||||
assert match, "No templates considered comment found"
|
||||
actual_considered = match.group(1)
|
||||
assert actual_considered == expected_considered
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue