Skip to content

Commit

Permalink
Adjust script viz unit tests, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Sep 4, 2024
1 parent 0fbb153 commit 08db1e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
## Add script tag
<% script_src = script_attributes.get("src") %>
<% script_type = script_attributes.get("type") or "module" %>
<script type="${script_type}" src=${script_src}></script>
<script type="${script_type}" src="${script_src}"></script>
</%def>
10 changes: 8 additions & 2 deletions lib/galaxy/app_unittest_utils/galaxy_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,14 @@ def remove(self):


class MockTemplateHelpers:
def js(*js_files):
def css(*css_files):
pass

def css(*css_files):
def dumps(*kwargs):
return {}

def js(*js_files):
pass

def url_for(*kwargs):
return "/"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

glx_dir = galaxy_directory()
template_cache_dir = os.path.join(glx_dir, "database", "compiled_templates")
addtional_templates_dir = os.path.join(glx_dir, "config", "plugins", "visualizations", "common", "templates")
additional_templates_dir = os.path.join(glx_dir, "config", "plugins", "visualizations", "common", "templates")
vis_reg_path = "config/plugins/visualizations"

config1 = """\
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_script_entry(self):
<model_class>HistoryDatasetAssociation</model_class>
</data_source>
</data_sources>
<entry_point entry_point_type="script" data-main="one" src="bler"></entry_point>
<entry_point entry_point_type="script" container="mycontainer" src="bler"></entry_point>
</visualization>
"""
)
Expand All @@ -167,11 +167,11 @@ def test_script_entry(self):
assert script_entry.serves_templates

trans = galaxy_mock.MockTrans()
script_entry._set_up_template_plugin(mock_app_dir.root_path, [addtional_templates_dir])
response = script_entry._render({}, trans=trans, embedded=True)
script_entry._set_up_template_plugin(mock_app_dir.root_path, [additional_templates_dir])
response = script_entry.render(trans=trans, embedded=True)
assert 'src="bler"' in response
assert 'type="text/javascript"' in response
assert 'data-main="one"' in response
assert 'id="mycontainer"' in response
mock_app_dir.remove()


Expand Down

0 comments on commit 08db1e3

Please sign in to comment.