diff --git a/datasette_acl/__init__.py b/datasette_acl/__init__.py index 7f35707..9dfe6d8 100644 --- a/datasette_acl/__init__.py +++ b/datasette_acl/__init__.py @@ -1,8 +1,10 @@ from datasette import hookimpl, Response, Permission, Forbidden from datasette.events import CreateTableEvent from datasette.utils import actor_matches_allow -import time import json +import sys +import time + CREATE_TABLES_SQL = """ create table if not exists acl_resources ( @@ -240,7 +242,9 @@ def permission_allowed(datasette, actor, action, resource): async def inner(): if not actor: return None - await update_dynamic_groups(datasette, actor) + await update_dynamic_groups( + datasette, actor, skip_cache=hasattr(sys, "_pytest_running") + ) db = datasette.get_internal_database() result = await db.execute( ACL_RESOURCE_PAIR_SQL, diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..07bf429 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,5 @@ +import sys + + +def pytest_configure(config): + sys._pytest_running = True