Commit 040f5cc9 by John Eskew

Move edxnotes model import down into method.

parent 7dfb6cc6
...@@ -7,7 +7,6 @@ import json ...@@ -7,7 +7,6 @@ import json
from django.conf import settings from django.conf import settings
from edxmako.shortcuts import render_to_string 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): def edxnotes(cls):
...@@ -20,6 +19,8 @@ def edxnotes(cls): ...@@ -20,6 +19,8 @@ def edxnotes(cls):
""" """
Returns raw html for the component. 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) is_studio = getattr(self.system, "is_author_mode", False)
course = self.descriptor.runtime.modulestore.get_course(self.runtime.course_id) course = self.descriptor.runtime.modulestore.get_course(self.runtime.course_id)
......
...@@ -106,10 +106,10 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase): ...@@ -106,10 +106,10 @@ class EdxNotesDecoratorTest(ModuleStoreTestCase):
self.problem = TestProblem(self.course) self.problem = TestProblem(self.course)
@patch.dict("django.conf.settings.FEATURES", {'ENABLE_EDXNOTES': True}) @patch.dict("django.conf.settings.FEATURES", {'ENABLE_EDXNOTES': True})
@patch("edxnotes.decorators.get_public_endpoint", autospec=True) @patch("edxnotes.helpers.get_public_endpoint", autospec=True)
@patch("edxnotes.decorators.get_token_url", autospec=True) @patch("edxnotes.helpers.get_token_url", autospec=True)
@patch("edxnotes.decorators.get_edxnotes_id_token", autospec=True) @patch("edxnotes.helpers.get_edxnotes_id_token", autospec=True)
@patch("edxnotes.decorators.generate_uid", 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): 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 Tests if get_html is wrapped when feature flag is on and edxnotes are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment