File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
openedx/core/djangoapps/content_libraries/tests Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2828 LIBRARY_COLLECTION_UPDATED ,
2929 LIBRARY_CONTAINER_UPDATED ,
3030)
31+ from openedx_authz .api .users import get_user_role_assignments_in_scope
3132from openedx_learning .api import authoring as authoring_api
3233
3334from .. import api
@@ -1479,3 +1480,26 @@ def test_get_backup_task_status_failed(self) -> None:
14791480 assert status is not None
14801481 assert status ['state' ] == UserTaskStatus .FAILED
14811482 assert status ['file' ] is None
1483+
1484+
1485+ class ContentLibraryRoleAssignmentTest (ContentLibrariesRestApiTest ):
1486+ """
1487+ Tests for Content Library API role assignment methods.
1488+ """
1489+
1490+ def setUp (self ) -> None :
1491+ super ().setUp ()
1492+
1493+ # Create Content Libraries
1494+ self ._create_library ("test-lib-role-1" , "Test Library Role 1" )
1495+
1496+ # Fetch the created ContentLibrary objects so we can access their learning_package.id
1497+ self .lib1 = ContentLibrary .objects .get (slug = "test-lib-role-1" )
1498+
1499+ def test_assign_library_role_to_user (self ) -> None :
1500+ """Test assigning a library role to a user."""
1501+ api .assign_library_role_to_user (self .lib1 .library_key , self .user , api .AccessLevel .ADMIN_LEVEL )
1502+
1503+ roles = get_user_role_assignments_in_scope (self .user .username , str (self .lib1 .library_key ))
1504+ assert len (roles ) == 1
1505+ assert "library_admin" in repr (roles [0 ].roles [0 ])
You can’t perform that action at this time.
0 commit comments