As proposed here:
from datasette_test import Datasette
ds = Datasette(
plugin_config={"datasette-extract": "..."},
permissions={"manage-secrets": {"id": "admin"}}
)
Where that permissions= thing uses config={"permissions": ...} for Datasette 1.0a+ and some more complex plugin-based mechanism for <1.0.
As proposed here: