Skip to content

Commit

Permalink
fix: --
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan committed May 22, 2024
1 parent effecbf commit d812859
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions xblock/test/utils/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,20 @@ class TestResourceLoader(unittest.TestCase):
"""

def test_load_unicode(self):
s = ResourceLoader(__package__).load_unicode("data/simple_django_template.txt")
s = ResourceLoader(__name__).load_unicode("data/simple_django_template.txt")
self.assertEqual(s, expected_string)

def test_load_unicode_from_another_module(self):
s = ResourceLoader("xblock.test.utils.data").load_unicode("simple_django_template.txt")
self.assertEqual(s, expected_string)

def test_render_django_template(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_django_template("data/simple_django_template.txt", example_context)
self.assertEqual(s, expected_filled_template)

def test_render_django_template_translated(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_django_template("data/trans_django_template.txt",
context=example_context,
i18n_service=MockI18nService())
Expand All @@ -179,31 +179,31 @@ def test_render_django_template_translated(self):

def test_render_django_template_localized(self):
# Test that default template tags like l10n are loaded
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_django_template("data/l10n_django_template.txt",
context=example_context,
i18n_service=MockI18nService())
self.assertEqual(s, expected_localized_template)

def test_render_mako_template(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_mako_template("data/simple_mako_template.txt", example_context)
self.assertEqual(s, expected_filled_template)

@patch('warnings.warn', DEFAULT)
def test_render_template_deprecated(self, mock_warn):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_template("data/simple_django_template.txt", example_context)
self.assertTrue(mock_warn.called)
self.assertEqual(s, expected_filled_template)

def test_render_js_template(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_js_template("data/simple_django_template.txt", example_id, example_context)
self.assertEqual(s, expected_filled_js_template)

def test_render_js_template_translated(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_js_template("data/trans_django_template.txt",
example_id,
context=example_context,
Expand All @@ -216,19 +216,19 @@ def test_render_js_template_translated(self):

def test_render_js_template_localized(self):
# Test that default template tags like l10n are loaded
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
s = loader.render_js_template("data/l10n_django_template.txt",
example_id,
context=example_context,
i18n_service=MockI18nService())
self.assertEqual(s, expected_filled_localized_js_template)

def test_load_scenarios(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
scenarios = loader.load_scenarios_from_path("data")
self.assertEqual(scenarios, expected_scenarios)

def test_load_scenarios_with_identifiers(self):
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)
scenarios = loader.load_scenarios_from_path("data", include_identifier=True)
self.assertEqual(scenarios, expected_scenarios_with_identifiers)
2 changes: 1 addition & 1 deletion xblock/utils/studio_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Globals ###########################################################

log = logging.getLogger(__name__)
loader = ResourceLoader(__package__)
loader = ResourceLoader(__name__)


# Classes ###########################################################
Expand Down

0 comments on commit d812859

Please sign in to comment.