Skip to content

Commit

Permalink
fix: improve test coverage %
Browse files Browse the repository at this point in the history
and fix formatting
  • Loading branch information
pomegranited committed Mar 11, 2024
1 parent e41daae commit b5a7c83
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platform_plugin_aspects/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_get_ccx_courses_feature_disabled(self):
"SUPERSET_CONFIG",
{
"internal_service_url": "http://superset:8088",
"service_url": "http://superset-dummy-url",
"service_url": "http://superset-dummy-url/",
"username": "superset",
"password": "superset",
},
Expand Down
17 changes: 17 additions & 0 deletions platform_plugin_aspects/tests/test_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,20 @@ def test_render_translations(
url_resource = resource
self.assertIsNotNone(url_resource, "No 'url' resource found in fragment")
self.assertIn("eo/text.js", url_resource.data)

@patch("platform_plugin_aspects.xblock.translation.get_language")
@patch("platform_plugin_aspects.utils._generate_guest_token")
def test_render_no_translations(
self,
mock_generate_guest_token,
mock_get_language,
):
"""
Ensure translated javascript is served.
"""
mock_generate_guest_token.return_value = ("test-token", "test-dashboard-uuid")
mock_get_language.return_value = None
xblock = make_an_xblock("instructor")
student_view = xblock.student_view()
for resource in student_view.resources:
assert resource.kind != "url"
4 changes: 1 addition & 3 deletions platform_plugin_aspects/xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def student_view(self, context=None):
context["xblock_id"] = str(self.scope_ids.usage_id.block_id)

frag = Fragment()
frag.add_content(
self.render_template("static/html/superset.html", context)
)
frag.add_content(self.render_template("static/html/superset.html", context))
frag.add_css(loader.load_unicode("static/css/superset.css"))
frag.add_javascript(loader.load_unicode("static/js/install_required.js"))

Expand Down

0 comments on commit b5a7c83

Please sign in to comment.