Skip to content

Commit cdf2603

Browse files
committed
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.
1 parent d423775 commit cdf2603

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lms/djangoapps/courseware/tests/test_navigation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from common.djangoapps.student.tests.factories import GlobalStaffFactory
1818
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase, set_preview_mode
1919
from openedx.features.course_experience import DISABLE_COURSE_OUTLINE_PAGE_FLAG
20+
from openedx.features.course_experience.url_helpers import make_learning_mfe_courseware_url
2021

2122

2223
@set_preview_mode(True)
@@ -111,7 +112,7 @@ def test_chrome_settings(self):
111112
assert ('course-navigation' in response.content.decode('utf-8')) == accordion
112113

113114
self.assertTabInactive('progress', response)
114-
self.assertTabActive('courseware', response)
115+
self.assertTabActive(make_learning_mfe_courseware_url(self.course.id), response)
115116

116117
response = self.client.get(reverse('courseware_section', kwargs={
117118
'course_id': str(self.course.id),
@@ -120,7 +121,7 @@ def test_chrome_settings(self):
120121
}))
121122

122123
self.assertTabActive('progress', response)
123-
self.assertTabInactive('courseware', response)
124+
self.assertTabInactive(make_learning_mfe_courseware_url(self.course.id), response)
124125

125126
@override_settings(SESSION_INACTIVITY_TIMEOUT_IN_SECONDS=1)
126127
def test_inactive_session_timeout(self):

openedx/core/djangoapps/user_api/tests/test_middleware.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.http import HttpResponse
66
from django.test import TestCase
77
from django.test.client import RequestFactory
8+
from django.urls import reverse
89

910
from common.djangoapps.student.tests.factories import AnonymousUserFactory, UserFactory
1011
from openedx.core.djangolib.testing.utils import skip_unless_lms
@@ -29,9 +30,7 @@ def setUp(self):
2930
self.course_id = 'mock/course/id'
3031
self.request_factory = RequestFactory()
3132

32-
# TODO: Make it so we can use reverse. Appears to fail depending on the order in which tests are run
33-
#self.request = RequestFactory().get(reverse('courseware', kwargs={'course_id': self.course_id}))
34-
self.request = RequestFactory().get(f'/courses/{self.course_id}/courseware')
33+
self.request = RequestFactory().get(reverse('progress', kwargs={'course_id': self.course_id}))
3534
self.request.user = self.user
3635

3736
self.response = Mock(spec=HttpResponse)

0 commit comments

Comments
 (0)