Skip to content

Commit e09781b

Browse files
author
Bernard Szabo
committed
feat: TNL-11812 Try static substitution
1 parent e4787e7 commit e09781b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

cms/djangoapps/contentstore/tests/test_tasks.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from unittest import mock, TestCase
99
from uuid import uuid4
1010

11+
import pytest as pytest
1112
from django.conf import settings
1213
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
1314
from django.test.utils import override_settings
@@ -17,7 +18,12 @@
1718
from organizations.tests.factories import OrganizationFactory
1819
from user_tasks.models import UserTaskArtifact, UserTaskStatus
1920

20-
from cms.djangoapps.contentstore.tasks import export_olx, update_special_exams_and_publish, rerun_course
21+
from cms.djangoapps.contentstore.tasks import (
22+
export_olx,
23+
update_special_exams_and_publish,
24+
rerun_course,
25+
_convert_to_standard_url
26+
)
2127
from cms.djangoapps.contentstore.tests.test_libraries import LibraryTestCase
2228
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
2329
from common.djangoapps.course_action_state.models import CourseRerunState
@@ -202,6 +208,8 @@ def test_register_exams_failure(self, _mock_register_exams_proctoring, _mock_reg
202208

203209

204210
class CourseOptimizerTestCase(TestCase):
211+
212+
205213
def test_user_does_not_exist_raises_exception(self):
206214
raise NotImplementedError
207215

@@ -220,8 +228,11 @@ def test_http_and_https_recognized_as_studio_url_schemes(self):
220228
def test_file_not_recognized_as_studio_url_scheme(self):
221229
raise NotImplementedError
222230

223-
def test_url_substitution_on_static_prefixes(self):
224-
raise NotImplementedError
231+
@pytest.mark.parametrize("url, course_key, post_substitution_url",
232+
["/static/anything_goes_here?raw", "1", "2"])
233+
def test_url_substitution_on_static_prefixes(self, url, course_key, post_substitution_url):
234+
with_substitution = _convert_to_standard_url(url, course_key)
235+
assert with_substitution == post_substitution_url
225236

226237
def test_url_substitution_on_forward_slash_prefixes(self):
227238
raise NotImplementedError

0 commit comments

Comments
 (0)