refactor: remove deprecated runtime.course_id from edxnotes decorator

We will use `context_key` instead.
This commit is contained in:
Agrendalath
2022-07-07 18:20:43 +02:00
parent 99042f6282
commit c2ac3d83c3
2 changed files with 9 additions and 10 deletions

View File

@@ -79,11 +79,10 @@ class TestProblem:
The purpose of this class is to imitate any problem.
"""
def __init__(self, course, user=None):
self.system = MagicMock(is_author_mode=False)
self.scope_ids = MagicMock(usage_id="test_usage_id")
self.scope_ids = MagicMock(usage_id=course.id.make_usage_key('test_problem', 'test_usage_id'))
user = user or UserFactory()
user_service = StubUserService(user)
self.runtime = MagicMock(course_id=course.id, service=lambda _a, _b: user_service)
self.runtime = MagicMock(service=lambda _a, _b: user_service, is_author_mode=False)
self.descriptor = MagicMock()
self.descriptor.runtime.modulestore.get_course.return_value = course
@@ -136,7 +135,7 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase):
"uid": "uid",
"edxnotes_visibility": "true",
"params": {
"usageId": "test_usage_id",
"usageId": problem.scope_ids.usage_id,
"courseId": course.id,
"token": "token",
"tokenUrl": "/tokenUrl",
@@ -167,7 +166,7 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase):
"""
Tests that get_html is not wrapped when problem is rendered in Studio.
"""
self.problem.system.is_author_mode = True
self.problem.runtime.is_author_mode = True
assert 'original_get_html' == self.problem.get_html()
def test_edxnotes_blockstore_runtime(self):