66
77import pytest
88from sanic_testing .testing import SanicASGITestClient
9+ from ulid import ULID
910
1011from renku_data_services .resource_usage .db import ResourceRequestsRepo
1112from renku_data_services .resource_usage .model import Credit , ResourceClassCost , ResourcePoolLimits
@@ -724,6 +725,8 @@ async def test_remove_resource_pool_users(
724725 assert res .status_code == 200
725726 assert len (existing_users ) >= 3
726727 # Give another user access to the private pool
728+ admin = existing_users [0 ]
729+ admin_id = admin ["id" ]
727730 allowed_user = existing_users [1 ]
728731 allowed_user2 = existing_users [2 ]
729732 allowed_user_id = allowed_user ["id" ]
@@ -748,8 +751,9 @@ async def test_remove_resource_pool_users(
748751 headers = admin_headers ,
749752 )
750753 assert res .status_code == 200
751- assert len (res .json ) == 2
752- assert set ([u ["id" ] for u in res .json ]) == {allowed_user_id , allowed_user2_id }
754+ # Authzed resolves ALL users with read permission (including inherited access i.e. in this case "admin"),
755+ assert len (res .json ) == 3
756+ assert set ([u ["id" ] for u in res .json ]) == {admin_id , allowed_user_id , allowed_user2_id }
753757 # Remove the user from the private pool
754758 _ , res = await sanic_client .delete (
755759 f"/api/data/resource_pools/{ rp_private ['id' ]} /users/{ allowed_user_id } " ,
@@ -767,7 +771,8 @@ async def test_remove_resource_pool_users(
767771 headers = admin_headers ,
768772 )
769773 assert res .status_code == 200
770- assert len (res .json ) == 1
774+ # Authzed resolves ALL users with read permission (including inherited access i.e. in this case "admin"),
775+ assert len (res .json ) == 2
771776 assert len ([user for user in res .json if user .get ("id" ) == allowed_user_id ]) == 0
772777 # The remaining user can see the pool
773778 user2_access_token = json .dumps ({"id" : allowed_user2_id })
0 commit comments