1616from rest_framework .request import Request
1717from rest_framework .test import APIRequestFactory
1818
19- from lms .djangoapps .courseware .courseware_access_exception import CoursewareAccessException
19+ from lms .djangoapps .courseware .exceptions import CourseAccessRedirect
2020from openedx .core .djangoapps .authz .tests .mixins import CourseAuthoringAuthzTestMixin
2121from openedx .core .djangoapps .content .course_overviews .models import CourseOverview
2222from xmodule .modulestore .exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order
@@ -168,7 +168,7 @@ def test_get_existing_course_as_authorized_user(self):
168168
169169 def test_get_existing_course_as_unauthorized_user (self ):
170170 """User without role should be denied."""
171- with pytest .raises (CoursewareAccessException ):
171+ with pytest .raises (CourseAccessRedirect ):
172172 self ._make_api_call (
173173 self .unauthorized_user ,
174174 self .unauthorized_user ,
@@ -204,7 +204,7 @@ def test_hidden_course_for_staff_as_unauthorized_user(self):
204204 Staff requesting data for another user without permissions
205205 should not bypass visibility rules.
206206 """
207- with pytest .raises (Http404 ):
207+ with pytest .raises (CourseAccessRedirect ):
208208 self ._make_api_call (
209209 self .staff_user ,
210210 self .unauthorized_user ,
@@ -213,7 +213,7 @@ def test_hidden_course_for_staff_as_unauthorized_user(self):
213213
214214 def test_user_gains_access_after_role_assignment (self ):
215215 """User initially denied, then allowed after role assignment."""
216- with pytest .raises (CoursewareAccessException ):
216+ with pytest .raises (CourseAccessRedirect ):
217217 self ._make_api_call (
218218 self .unauthorized_user ,
219219 self .unauthorized_user ,
0 commit comments