test: Remove reference to the courseware url.

The courseware URL is going away but it's just used here to test the
middleware.  That can be test with other urls that are relevant to this
middleware.

Note, I was unable to re-produce the failures so I've put back using the
standard `reverse` logic for fetching the URL in the test.
This commit is contained in:
Feanil Patel
2025-03-19 13:16:57 -04:00
parent d423775012
commit cdf26039e6
2 changed files with 5 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory
from common.djangoapps.student.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase, set_preview_mode
from openedx.features.course_experience import DISABLE_COURSE_OUTLINE_PAGE_FLAG
from openedx.features.course_experience.url_helpers import make_learning_mfe_courseware_url
@set_preview_mode(True)
@@ -111,7 +112,7 @@ class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
assert ('course-navigation' in response.content.decode('utf-8')) == accordion
self.assertTabInactive('progress', response)
self.assertTabActive('courseware', response)
self.assertTabActive(make_learning_mfe_courseware_url(self.course.id), response)
response = self.client.get(reverse('courseware_section', kwargs={
'course_id': str(self.course.id),
@@ -120,7 +121,7 @@ class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
}))
self.assertTabActive('progress', response)
self.assertTabInactive('courseware', response)
self.assertTabInactive(make_learning_mfe_courseware_url(self.course.id), response)
@override_settings(SESSION_INACTIVITY_TIMEOUT_IN_SECONDS=1)
def test_inactive_session_timeout(self):

View File

@@ -5,6 +5,7 @@ from unittest.mock import Mock, patch
from django.http import HttpResponse
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls import reverse
from common.djangoapps.student.tests.factories import AnonymousUserFactory, UserFactory
from openedx.core.djangolib.testing.utils import skip_unless_lms
@@ -29,9 +30,7 @@ class TagsMiddlewareTest(TestCase):
self.course_id = 'mock/course/id'
self.request_factory = RequestFactory()
# TODO: Make it so we can use reverse. Appears to fail depending on the order in which tests are run
#self.request = RequestFactory().get(reverse('courseware', kwargs={'course_id': self.course_id}))
self.request = RequestFactory().get(f'/courses/{self.course_id}/courseware')
self.request = RequestFactory().get(reverse('progress', kwargs={'course_id': self.course_id}))
self.request.user = self.user
self.response = Mock(spec=HttpResponse)