99
1010import ddt
1111import pytz
12+ from crum import set_current_request
1213from django .conf import settings
1314from django .test .utils import override_settings
1415from django .urls import reverse
@@ -224,7 +225,12 @@ def test_about_page_public_view(self, course_visibility):
224225 self .assertContains (resp , "Enroll Now" )
225226
226227
227- class AuthzAboutPageTestCase (CourseAuthoringAuthzTestMixin , LoginEnrollmentTestCase , SharedModuleStoreTestCase ):
228+ class AuthzAboutPageTestCase (
229+ CourseAuthoringAuthzTestMixin ,
230+ LoginEnrollmentTestCase ,
231+ SharedModuleStoreTestCase ,
232+ EventTrackingTestCase ,
233+ ):
228234 """
229235 About page HTTP access when AuthZ course authoring is enabled.
230236 """
@@ -237,11 +243,16 @@ def setUpClass(cls):
237243 CourseDetails .update_about_item (cls .course_without_about , "overview" , "WITHOUT ABOUT" , None )
238244 CourseDetails .update_about_item (cls .course_with_about , "overview" , "WITH ABOUT" , None )
239245
246+ def setUp (self ):
247+ super ().setUp ()
248+ self .addCleanup (set_current_request , None )
249+ self .assertTrue ( # noqa: PT009
250+ self .client .login (username = self .unauthorized_user .username , password = self .password )
251+ )
252+
240253 @override_settings (COURSE_ABOUT_VISIBILITY_PERMISSION = "see_about_page" )
241254 def test_about_page_honors_catalog_visibility_without_authz_role (self ):
242255 """A learner without AuthZ roles can view catalog-visible about pages."""
243- self .client .force_login (self .unauthorized_user )
244-
245256 url = reverse ("about_course" , args = [str (self .course_with_about .id )])
246257 resp = self .client .get (url )
247258 self .assertContains (resp , "WITH ABOUT" )
0 commit comments