-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from opaque_keys.edx.keys import UsageKey | ||
|
||
from common.djangoapps.student.tests.factories import UserFactory | ||
from openedx.core.djangoapps.content_libraries.tests.base import ( | ||
ContentLibrariesRestApiTest, | ||
) | ||
|
@@ -167,3 +168,19 @@ def test_anonymous_user(self): | |
f"/library_assets/{self.draft_component_version.uuid}/static/test.svg" | ||
) | ||
assert response.status_code == 403 | ||
|
||
def test_unauthorized_user(self): | ||
"""User who is not a Content Library staff should not have access.""" | ||
self.client.logout() | ||
student = UserFactory.create( | ||
username="student", | ||
email="[email protected]", | ||
password="student-pass", | ||
is_staff=False, | ||
is_superuser=False, | ||
) | ||
self.client.login(username="student", password="student-pass") | ||
get_response = self.client.get( | ||
f"/library_assets/{self.draft_component_version.uuid}/static/test.svg" | ||
) | ||
assert get_response.status_code == 403 |