|
37 | 37 | ) |
38 | 38 | from openedx.core.djangoapps.xblock import api as xblock_api |
39 | 39 | from openedx.core.djangolib.testing.utils import skip_unless_cms |
| 40 | +from openedx_authz.constants.permissions import VIEW_LIBRARY |
40 | 41 |
|
41 | 42 | from ..models import ContentLibrary |
42 | 43 | from ..permissions import CAN_VIEW_THIS_CONTENT_LIBRARY, HasPermissionInContentLibraryScope |
@@ -1365,7 +1366,7 @@ def test_authz_scope_q_object_has_correct_structure(self): |
1365 | 1366 | (Q(org__short_name='org1') & Q(slug='lib1')) | (Q(org__short_name='org2') & Q(slug='lib2')) |
1366 | 1367 | """ |
1367 | 1368 | user = UserFactory.create(username="q_user") |
1368 | | - rule = HasPermissionInContentLibraryScope('view_library', filter_keys=['org', 'slug']) |
| 1369 | + rule = HasPermissionInContentLibraryScope(VIEW_LIBRARY, filter_keys=['org', 'slug']) |
1369 | 1370 |
|
1370 | 1371 | with patch( |
1371 | 1372 | "openedx.core.djangoapps.content_libraries.permissions.get_scopes_for_user_and_permission" |
@@ -1428,7 +1429,7 @@ def test_authz_scope_q_object_matches_exact_org_slug_pairs(self): |
1428 | 1429 | - lib4: org3 + lib1 (NOT authorized - same slug, different org) |
1429 | 1430 | """ |
1430 | 1431 | user = UserFactory.create(username="exact_pair_user") |
1431 | | - rule = HasPermissionInContentLibraryScope('view_library', filter_keys=['org', 'slug']) |
| 1432 | + rule = HasPermissionInContentLibraryScope(VIEW_LIBRARY, filter_keys=['org', 'slug']) |
1432 | 1433 |
|
1433 | 1434 | Organization.objects.get_or_create(short_name="pair-org1", defaults={"name": "Pair Org 1"}) |
1434 | 1435 | Organization.objects.get_or_create(short_name="pair-org2", defaults={"name": "Pair Org 2"}) |
|
0 commit comments