mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Added test for async startup hook, refs #834
This commit is contained in:
parent
09a3479a54
commit
72ae975156
2 changed files with 9 additions and 0 deletions
|
|
@ -120,3 +120,11 @@ def permission_allowed(datasette, actor, action):
|
|||
return False
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
@hookimpl
|
||||
def startup(datasette):
|
||||
async def inner():
|
||||
result = await datasette.get_database().execute("select 1 + 1")
|
||||
datasette._startup_hook_calculation = result.first()[0]
|
||||
return inner
|
||||
|
|
|
|||
|
|
@ -578,3 +578,4 @@ def test_register_routes_asgi(app_client):
|
|||
async def test_startup(app_client):
|
||||
await app_client.ds.invoke_startup()
|
||||
assert app_client.ds._startup_hook_fired
|
||||
assert 2 == app_client.ds._startup_hook_calculation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue