Skip to content

Commit 12262ba

Browse files
refactor: use view library object instead of string in tests
1 parent d89f1dc commit 12262ba

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
)
3838
from openedx.core.djangoapps.xblock import api as xblock_api
3939
from openedx.core.djangolib.testing.utils import skip_unless_cms
40+
from openedx_authz.constants.permissions import VIEW_LIBRARY
4041

4142
from ..models import ContentLibrary
4243
from ..permissions import CAN_VIEW_THIS_CONTENT_LIBRARY, HasPermissionInContentLibraryScope
@@ -1365,7 +1366,7 @@ def test_authz_scope_q_object_has_correct_structure(self):
13651366
(Q(org__short_name='org1') & Q(slug='lib1')) | (Q(org__short_name='org2') & Q(slug='lib2'))
13661367
"""
13671368
user = UserFactory.create(username="q_user")
1368-
rule = HasPermissionInContentLibraryScope('view_library', filter_keys=['org', 'slug'])
1369+
rule = HasPermissionInContentLibraryScope(VIEW_LIBRARY, filter_keys=['org', 'slug'])
13691370

13701371
with patch(
13711372
"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):
14281429
- lib4: org3 + lib1 (NOT authorized - same slug, different org)
14291430
"""
14301431
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'])
14321433

14331434
Organization.objects.get_or_create(short_name="pair-org1", defaults={"name": "Pair Org 1"})
14341435
Organization.objects.get_or_create(short_name="pair-org2", defaults={"name": "Pair Org 2"})

0 commit comments

Comments
 (0)