Skip to content

Commit ae87974

Browse files
authored
Allow tests for Extracted & Builtin Discussion XBlock (openedx#37875)
* chore: test enable PR for extracted discussion block
1 parent 919a479 commit ae87974

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

lms/djangoapps/courseware/tests/test_discussion_xblock.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ def test_studio_view(self, mock_render_django_template):
163163
"""
164164
fragment = self.block.author_view()
165165
assert isinstance(fragment, Fragment)
166-
mock_render_django_template.assert_called_once_with(
167-
'templates/discussion/_discussion_inline_studio.html',
168-
{
169-
'discussion_id': self.discussion_id,
170-
'is_visible': True,
171-
}
172-
)
166+
mock_render_django_template.assert_called_once()
167+
call_args = mock_render_django_template.call_args[0]
168+
assert call_args[0].endswith('_discussion_inline_studio.html')
169+
assert call_args[1] == {
170+
'discussion_id': self.discussion_id,
171+
'is_visible': True,
172+
}
173173

174174
@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
175175
@ddt.data(
@@ -203,7 +203,7 @@ def test_student_perms_are_correct(self, permissions):
203203
)
204204

205205
self.block.has_permission = lambda perm: permission_dict[perm]
206-
with mock.patch('xmodule.discussion_block.render_to_string', return_value='') as mock_render:
206+
with mock.patch(f'{DiscussionXBlock.__module__}.render_to_string', return_value='') as mock_render:
207207
self.block.student_view()
208208
# Get context from the mock call
209209
assert mock_render.call_count == 1
@@ -216,7 +216,7 @@ def test_js_init(self):
216216
"""
217217
Test proper js init function is called.
218218
"""
219-
with mock.patch('xmodule.discussion_block.render_to_string', return_value=''):
219+
with mock.patch(f'{DiscussionXBlock.__module__}.render_to_string', return_value=''):
220220
fragment = self.block.student_view()
221221
assert fragment.js_init_fn == 'DiscussionInlineBlock'
222222

0 commit comments

Comments
 (0)