@@ -81,6 +81,7 @@ def setUp(self):
8181 self .admin = AdminFactory .create ()
8282 self .instructor = InstructorFactory .create (course_key = self .course_key )
8383 self .staff = StaffFactory .create (course_key = self .course_key )
84+ self .django_staff_user = UserFactory .create (is_staff = True )
8485 self .data_researcher = UserFactory .create ()
8586 CourseDataResearcherRole (self .course_key ).add_users (self .data_researcher )
8687 CourseInstructorRole (self .proctored_course .id ).add_users (self .instructor )
@@ -127,7 +128,7 @@ def test_get_course_metadata_as_instructor(self):
127128 self .client .force_authenticate (user = self .instructor )
128129 response = self .client .get (self ._get_url ())
129130
130- self . assertEqual ( response .status_code , status .HTTP_200_OK ) # noqa: PT009
131+ assert response .status_code == status .HTTP_200_OK
131132 data = response .data
132133
133134 # Verify basic course information
@@ -193,6 +194,19 @@ def test_admin_console_url_requires_instructor_access(self):
193194 data = response .data
194195 assert data ['admin_console_url' ] is None
195196
197+ @override_settings (ADMIN_CONSOLE_MICROFRONTEND_URL = 'http://localhost:2025/admin-console' )
198+ def test_django_staff_user_without_instructor_access_can_see_admin_console_url (self ):
199+ """
200+ Test that Django staff users without instructor access can see the admin console URL.
201+ """
202+ self .client .force_authenticate (user = self .django_staff_user )
203+ response = self .client .get (self ._get_url ())
204+
205+ assert response .status_code == status .HTTP_200_OK
206+ assert 'admin_console_url' in response .data
207+ data = response .data
208+ assert data ['admin_console_url' ] == 'http://localhost:2025/admin-console/authz'
209+
196210 def test_get_course_metadata_as_staff (self ):
197211 """
198212 Test that course staff can retrieve course metadata.
0 commit comments