55
66import pytest
77from sanic_testing .testing import SanicASGITestClient
8+ from ulid import ULID
89
910from test .bases .renku_data_services .data_api .utils import create_rp
1011from test .utils import KindCluster
@@ -720,6 +721,8 @@ async def test_remove_resource_pool_users(
720721 assert res .status_code == 200
721722 assert len (existing_users ) >= 3
722723 # Give another user access to the private pool
724+ admin = existing_users [0 ]
725+ admin_id = admin ["id" ]
723726 allowed_user = existing_users [1 ]
724727 allowed_user2 = existing_users [2 ]
725728 allowed_user_id = allowed_user ["id" ]
@@ -744,8 +747,9 @@ async def test_remove_resource_pool_users(
744747 headers = admin_headers ,
745748 )
746749 assert res .status_code == 200
747- assert len (res .json ) == 2
748- assert set ([u ["id" ] for u in res .json ]) == {allowed_user_id , allowed_user2_id }
750+ # Authzed resolves ALL users with read permission (including inherited access i.e. in this case "admin"),
751+ assert len (res .json ) == 3
752+ assert set ([u ["id" ] for u in res .json ]) == {admin_id , allowed_user_id , allowed_user2_id }
749753 # Remove the user from the private pool
750754 _ , res = await sanic_client .delete (
751755 f"/api/data/resource_pools/{ rp_private ['id' ]} /users/{ allowed_user_id } " ,
@@ -763,7 +767,8 @@ async def test_remove_resource_pool_users(
763767 headers = admin_headers ,
764768 )
765769 assert res .status_code == 200
766- assert len (res .json ) == 1
770+ # Authzed resolves ALL users with read permission (including inherited access i.e. in this case "admin"),
771+ assert len (res .json ) == 2
767772 assert len ([user for user in res .json if user .get ("id" ) == allowed_user_id ]) == 0
768773 # The remaining user can see the pool
769774 user2_access_token = json .dumps ({"id" : allowed_user2_id })
0 commit comments