-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix matching of /c4x/ in course asset view urlpatterns
This was failing to capture /c4x/ URLs when the `content_server.use_view` waffle flag was enabled, so we were returning 404s for those during our rollout test. Part of #34702
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Tests for the view version of course asset serving. | ||
""" | ||
|
||
import ddt | ||
from django.test import TestCase | ||
from django.urls import resolve | ||
|
||
|
||
@ddt.ddt | ||
class UrlsTest(TestCase): | ||
""" | ||
Tests for ensuring that the urlpatterns registered to the view are | ||
appropriate for the URLs that the middleware historically handled. | ||
""" | ||
|
||
@ddt.data( | ||
'/c4x/edX/Open_DemoX/asset/images_course_image.jpg', | ||
'/asset-v1:edX+DemoX.1+2T2019+type@asset+block/DemoX-poster.jpg', | ||
'/assets/courseware/v1/0123456789abcdef0123456789abcdef/asset-v1:edX+FAKE101+2024+type@asset+block/HW1.png', | ||
) | ||
def test_sample_urls(self, sample_url): | ||
""" | ||
Regression test -- c4x URL was previously incorrect in urls.py. | ||
""" | ||
assert resolve(sample_url).view_name == 'openedx.core.djangoapps.contentserver.views.course_assets_view' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters