Move edxnotes model import down into method.
This commit is contained in:
@@ -7,7 +7,6 @@ import json
|
||||
from django.conf import settings
|
||||
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from edxnotes.helpers import generate_uid, get_edxnotes_id_token, get_public_endpoint, get_token_url, is_feature_enabled
|
||||
|
||||
|
||||
def edxnotes(cls):
|
||||
@@ -20,6 +19,8 @@ def edxnotes(cls):
|
||||
"""
|
||||
Returns raw html for the component.
|
||||
"""
|
||||
# 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
|
||||
is_studio = getattr(self.system, "is_author_mode", False)
|
||||
course = self.descriptor.runtime.modulestore.get_course(self.runtime.course_id)
|
||||
|
||||
|
||||
@@ -106,10 +106,10 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase):
|
||||
self.problem = TestProblem(self.course)
|
||||
|
||||
@patch.dict("django.conf.settings.FEATURES", {'ENABLE_EDXNOTES': True})
|
||||
@patch("edxnotes.decorators.get_public_endpoint", autospec=True)
|
||||
@patch("edxnotes.decorators.get_token_url", autospec=True)
|
||||
@patch("edxnotes.decorators.get_edxnotes_id_token", autospec=True)
|
||||
@patch("edxnotes.decorators.generate_uid", autospec=True)
|
||||
@patch("edxnotes.helpers.get_public_endpoint", autospec=True)
|
||||
@patch("edxnotes.helpers.get_token_url", autospec=True)
|
||||
@patch("edxnotes.helpers.get_edxnotes_id_token", autospec=True)
|
||||
@patch("edxnotes.helpers.generate_uid", autospec=True)
|
||||
def test_edxnotes_enabled(self, mock_generate_uid, mock_get_id_token, mock_get_token_url, mock_get_endpoint):
|
||||
"""
|
||||
Tests if get_html is wrapped when feature flag is on and edxnotes are
|
||||
|
||||
Reference in New Issue
Block a user