2929 get_role_definitions_in_scope ,
3030 get_subject_role_assignments ,
3131 get_subject_role_assignments_in_scope ,
32- get_subjects_role_assignments_for_role_in_scope ,
32+ get_subject_role_assignments_for_role_in_scope ,
3333 unassign_role_from_subject_in_scope ,
3434)
3535from openedx_authz .engine .enforcer import enforcer as global_enforcer
@@ -572,7 +572,7 @@ def test_get_subject_role_assignments_in_scope(
572572 SubjectData (external_key = subject_name ), ScopeData (external_key = scope_name )
573573 )
574574
575- role_names = {assignment . role . external_key for assignment in role_assignments }
575+ role_names = {r . external_key for assignment in role_assignments for r in assignment . roles }
576576 self .assertEqual (role_names , expected_roles )
577577
578578 @ddt_data (
@@ -758,7 +758,7 @@ def test_get_all_role_assignments_scopes(self, subject_name, expected_roles):
758758 for expected_role in expected_roles :
759759 # Compare the role part of the assignment
760760 found = any (
761- assignment . role == expected_role for assignment in role_assignments
761+ expected_role in assignment . roles for assignment in role_assignments
762762 )
763763 self .assertTrue (
764764 found , f"Expected role { expected_role } not found in assignments"
@@ -797,7 +797,7 @@ def test_get_role_assignments_in_scope(self, role_name, scope_name, expected_cou
797797 Expected result:
798798 - The number of role assignments in the given scope is correctly retrieved.
799799 """
800- role_assignments = get_subjects_role_assignments_for_role_in_scope (
800+ role_assignments = get_subject_role_assignments_for_role_in_scope (
801801 RoleData (external_key = role_name ), ScopeData (external_key = scope_name )
802802 )
803803
@@ -860,7 +860,7 @@ def test_batch_assign_role_to_subjects_in_scope(
860860 user_roles = get_subject_role_assignments_in_scope (
861861 SubjectData (external_key = subject_name ), ScopeData (external_key = scope_name )
862862 )
863- role_names = {assignment . role . external_key for assignment in user_roles }
863+ role_names = {r . external_key for assignment in user_roles for r in assignment . roles }
864864 self .assertIn (role , role_names )
865865 else :
866866 assign_role_to_subject_in_scope (
@@ -872,7 +872,7 @@ def test_batch_assign_role_to_subjects_in_scope(
872872 SubjectData (external_key = subject_names ),
873873 ScopeData (external_key = scope_name ),
874874 )
875- role_names = {assignment . role . external_key for assignment in user_roles }
875+ role_names = {r . external_key for assignment in user_roles for r in assignment . roles }
876876 self .assertIn (role , role_names )
877877
878878 @ddt_data (
@@ -917,7 +917,7 @@ def test_unassign_role_from_subject_in_scope(
917917 SubjectData (external_key = subject ),
918918 ScopeData (external_key = scope_name ),
919919 )
920- role_names = {assignment . role . external_key for assignment in user_roles }
920+ role_names = {r . external_key for assignment in user_roles for r in assignment . roles }
921921 self .assertNotIn (role , role_names )
922922 else :
923923 unassign_role_from_subject_in_scope (
@@ -929,7 +929,7 @@ def test_unassign_role_from_subject_in_scope(
929929 SubjectData (external_key = subject_names ),
930930 ScopeData (external_key = scope_name ),
931931 )
932- role_names = {assignment . role . external_key for assignment in user_roles }
932+ role_names = {r . external_key for assignment in user_roles for r in assignment . roles }
933933 self .assertNotIn (role , role_names )
934934
935935 @ddt_data (
@@ -938,7 +938,7 @@ def test_unassign_role_from_subject_in_scope(
938938 [
939939 RoleAssignmentData (
940940 subject = SubjectData (external_key = "alice" ),
941- role = RoleData (
941+ roles = [ RoleData (
942942 external_key = "library_admin" ,
943943 permissions = [
944944 PermissionData (
@@ -986,7 +986,7 @@ def test_unassign_role_from_subject_in_scope(
986986 effect = "allow" ,
987987 ),
988988 ],
989- ),
989+ )] ,
990990 scope = ScopeData (external_key = "lib:Org1:math_101" ),
991991 )
992992 ],
@@ -996,7 +996,7 @@ def test_unassign_role_from_subject_in_scope(
996996 [
997997 RoleAssignmentData (
998998 subject = SubjectData (external_key = "bob" ),
999- role = RoleData (
999+ roles = [ RoleData (
10001000 external_key = "library_author" ,
10011001 permissions = [
10021002 PermissionData (
@@ -1038,7 +1038,7 @@ def test_unassign_role_from_subject_in_scope(
10381038 effect = "allow" ,
10391039 ),
10401040 ],
1041- ),
1041+ )] ,
10421042 scope = ScopeData (external_key = "lib:Org1:history_201" ),
10431043 )
10441044 ],
@@ -1048,7 +1048,7 @@ def test_unassign_role_from_subject_in_scope(
10481048 [
10491049 RoleAssignmentData (
10501050 subject = SubjectData (external_key = "carol" ),
1051- role = RoleData (
1051+ roles = [ RoleData (
10521052 external_key = "library_collaborator" ,
10531053 permissions = [
10541054 PermissionData (
@@ -1084,7 +1084,7 @@ def test_unassign_role_from_subject_in_scope(
10841084 effect = "allow" ,
10851085 ),
10861086 ],
1087- ),
1087+ )] ,
10881088 scope = ScopeData (external_key = "lib:Org1:science_301" ),
10891089 )
10901090 ],
@@ -1094,7 +1094,7 @@ def test_unassign_role_from_subject_in_scope(
10941094 [
10951095 RoleAssignmentData (
10961096 subject = SubjectData (external_key = "dave" ),
1097- role = RoleData (
1097+ roles = [ RoleData (
10981098 external_key = "library_user" ,
10991099 permissions = [
11001100 PermissionData (
@@ -1110,7 +1110,7 @@ def test_unassign_role_from_subject_in_scope(
11101110 effect = "allow" ,
11111111 ),
11121112 ],
1113- ),
1113+ )] ,
11141114 scope = ScopeData (external_key = "lib:Org1:english_101" ),
11151115 )
11161116 ],
0 commit comments