Disable edxnotes for blockstore runtime.

Blockstore runtime does not support courses currently and it will
not have the modulestore attribute in any case.
This commit is contained in:
Usman Khalid
2019-09-18 19:54:55 +05:00
parent f43fd893f2
commit 997f765eaf
2 changed files with 12 additions and 0 deletions

View File

@@ -24,6 +24,11 @@ def edxnotes(cls):
"""
# Import is placed here to avoid model import at project startup.
from edxnotes.helpers import generate_uid, get_edxnotes_id_token, get_public_endpoint, get_token_url, is_feature_enabled
runtime = getattr(self, 'descriptor', self).runtime
if not hasattr(runtime, 'modulestore'):
return original_get_html(self, *args, **kwargs)
is_studio = getattr(self.system, "is_author_mode", False)
course = getattr(self, 'descriptor', self).runtime.modulestore.get_course(self.runtime.course_id)

View File

@@ -172,6 +172,13 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase):
self.problem.system.is_author_mode = True
self.assertEqual("original_get_html", self.problem.get_html())
def test_edxnotes_blockstore_runtime(self):
"""
Tests that get_html is not wrapped when problem is rendered by Blockstore runtime.
"""
del self.problem.descriptor.runtime.modulestore
self.assertEqual("original_get_html", self.problem.get_html())
def test_edxnotes_harvard_notes_enabled(self):
"""
Tests that get_html is not wrapped when Harvard Annotation Tool is enabled.