File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
diracx-routers/tests/jobs Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ async def test_sandbox_access_policy_create(sandbox_metadata_db):
265265 ##############
266266
267267
268- async def test_sandbox_access_policy_read (sandbox_metadata_db ):
268+ async def test_sandbox_access_policy_read (sandbox_metadata_db , monkeypatch ):
269269
270270 admin_user = AuthorizedUserInfo (properties = [JOB_ADMINISTRATOR ], ** base_payload )
271271 normal_user = AuthorizedUserInfo (properties = [NORMAL_USER ], ** base_payload )
@@ -299,6 +299,17 @@ async def test_sandbox_access_policy_read(sandbox_metadata_db):
299299 )
300300
301301 # User can act on his own sandbox
302+ async def get_owner_id (* args ):
303+ return 1
304+
305+ async def get_sandbox_owner_id (* args ):
306+ return 1
307+
308+ monkeypatch .setattr (sandbox_metadata_db , "get_owner_id" , get_owner_id )
309+ monkeypatch .setattr (
310+ sandbox_metadata_db , "get_sandbox_owner_id" , get_sandbox_owner_id
311+ )
312+
302313 await SandboxAccessPolicy .policy (
303314 SANDBOX_POLICY_NAME ,
304315 normal_user ,
@@ -309,6 +320,11 @@ async def test_sandbox_access_policy_read(sandbox_metadata_db):
309320 )
310321
311322 # User cannot act on others
323+ async def get_owner_id (* args ):
324+ return 2
325+
326+ monkeypatch .setattr (sandbox_metadata_db , "get_owner_id" , get_owner_id )
327+
312328 with pytest .raises (HTTPException ):
313329 await SandboxAccessPolicy .policy (
314330 SANDBOX_POLICY_NAME ,
You can’t perform that action at this time.
0 commit comments