fix: refactor MakoService to allow specifying namespace per template (#33061)
This commit is contained in:
@@ -148,7 +148,7 @@ class TestVideoYouTube(TestVideo): # lint-amnesty, pylint: disable=missing-clas
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
|
||||
class TestVideoNonYouTube(TestVideo): # pylint: disable=test-inherits-tests
|
||||
@@ -233,7 +233,7 @@ class TestVideoNonYouTube(TestVideo): # pylint: disable=test-inherits-tests
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
expected_result = get_context_dict_from_string(
|
||||
mako_service.render_template('video.html', expected_context)
|
||||
mako_service.render_lms_template('video.html', expected_context)
|
||||
)
|
||||
assert get_context_dict_from_string(context) == expected_result
|
||||
assert expected_result['download_video_link'] == 'example.mp4'
|
||||
@@ -506,7 +506,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
def test_get_html_source(self):
|
||||
# lint-amnesty, pylint: disable=invalid-name, redefined-outer-name
|
||||
@@ -620,7 +620,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
def test_get_html_with_non_existent_edx_video_id(self):
|
||||
"""
|
||||
@@ -766,7 +766,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
def test_get_html_with_existing_edx_video_id(self):
|
||||
"""
|
||||
@@ -794,7 +794,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
context, expected_context = self.helper_get_html_with_edx_video_id(data)
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
def test_get_html_with_existing_unstripped_edx_video_id(self):
|
||||
"""
|
||||
@@ -825,7 +825,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
def encode_and_create_video(self, edx_video_id):
|
||||
"""
|
||||
@@ -1050,7 +1050,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def test_get_html_cdn_source_external_video(self):
|
||||
@@ -1156,7 +1156,7 @@ class TestGetHtmlMethod(BaseTestVideoXBlock):
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
assert get_context_dict_from_string(context) ==\
|
||||
get_context_dict_from_string(mako_service.render_template('video.html', expected_context))
|
||||
get_context_dict_from_string(mako_service.render_lms_template('video.html', expected_context))
|
||||
|
||||
@ddt.data(
|
||||
(True, ['youtube', 'desktop_webm', 'desktop_mp4', 'hls']),
|
||||
@@ -2409,7 +2409,7 @@ class TestVideoWithBumper(TestVideo): # pylint: disable=test-inherits-tests
|
||||
}
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
expected_content = mako_service.render_template('video.html', expected_context)
|
||||
expected_content = mako_service.render_lms_template('video.html', expected_context)
|
||||
assert get_context_dict_from_string(content) == get_context_dict_from_string(expected_content)
|
||||
|
||||
|
||||
@@ -2506,7 +2506,7 @@ class TestAutoAdvanceVideo(TestVideo): # lint-amnesty, pylint: disable=test-inh
|
||||
|
||||
mako_service = self.block.runtime.service(self.block, 'mako')
|
||||
with override_settings(FEATURES=self.FEATURES):
|
||||
expected_content = mako_service.render_template('video.html', expected_context)
|
||||
expected_content = mako_service.render_lms_template('video.html', expected_context)
|
||||
|
||||
assert get_context_dict_from_string(content) == get_context_dict_from_string(expected_content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user