@@ -258,18 +258,6 @@ async def test_check_access_expressions(access_model: RoleBasedAccessModel):
258258
259259 assert await has_access_by_role (access_model , R .ANONYMOUS , "study.stop" )
260260
261- assert await has_access_by_role (
262- access_model , R .ANONYMOUS , "study.stop |study.node.create"
263- )
264-
265- assert not await has_access_by_role (
266- access_model , R .ANONYMOUS , "study.stop & study.node.create"
267- )
268-
269- assert await has_access_by_role (
270- access_model , R .USER , "study.stop & study.node.create"
271- )
272-
273261
274262@pytest .fixture
275263def mock_db (mocker : MockerFixture ) -> MagicMock :
@@ -314,17 +302,17 @@ async def test_authorization_policy_cache(mocker: MockerFixture, mock_db: MagicM
314302 # pylint: disable=no-member
315303 autz_cache : BaseCache = authz_policy ._get_authorized_user_or_none .cache
316304
317- assert not (
await autz_cache .
exists (
"_get_auth_or_none /[email protected] " ))
305+ assert not (
await autz_cache .
exists (
"_get_authorized_user_or_none /[email protected] " ))
318306 for _ in range (3 ):
319307 got = await authz_policy .
_get_authorized_user_or_none (
email = "[email protected] " )
320308 assert mock_db .call_count == 1
321309 assert got ["id" ] == 1
322310
323- assert await autz_cache .
exists (
"_get_auth_or_none /[email protected] " )
311+ assert await autz_cache .
exists (
"_get_authorized_user_or_none /[email protected] " )
324312
325313 # new value in db
326314 mock_db .
users_db [
"[email protected] " ][
"id" ]
= 2 327- got = await autz_cache .
get (
"_get_auth_or_none /[email protected] " )
315+ got = await autz_cache .
get (
"_get_authorized_user_or_none /[email protected] " )
328316 assert got ["id" ] == 1
329317
330318 # gets cache, db is NOT called
@@ -341,12 +329,12 @@ async def test_authorization_policy_cache(mocker: MockerFixture, mock_db: MagicM
341329 assert got ["id" ] == 2
342330
343331 # other email has other key
344- assert not (
await autz_cache .
exists (
"_get_auth_or_none /[email protected] " ))
332+ assert not (
await autz_cache .
exists (
"_get_authorized_user_or_none /[email protected] " ))
345333
346334 for _ in range (4 ):
347335 # NOTE: None
348336 assert await authz_policy .
_get_authorized_user_or_none (
email = "[email protected] " )
349- assert await autz_cache .
exists (
"_get_auth_or_none /[email protected] " )
337+ assert await autz_cache .
exists (
"_get_authorized_user_or_none /[email protected] " )
350338 assert mock_db .call_count == 3
351339
352340 # should raise web.HTTPServiceUnavailable on db failure
0 commit comments