Skip to content

Commit

Permalink
Test tool shed version as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek authored and jmchilton committed Nov 16, 2023
1 parent c3dc92b commit ca5fce7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/galaxy_test/base/uses_shed_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,28 @@ def install_repo_request(self, payload: Dict[str, Any]) -> Response:
)

def repository_operation(
self, operation: OperationT, owner: str, name: str, changeset: str, tool_shed_url: str = DEFAULT_TOOL_SHED_URL
self,
operation: OperationT,
owner: str,
name: str,
changeset: str,
tool_shed_url: str = DEFAULT_TOOL_SHED_URL,
tool_panel_section_id: Optional[str] = None,
) -> Dict[str, Any]:
payload = {"tool_shed_url": tool_shed_url, "name": name, "owner": owner, "changeset_revision": changeset}
if tool_panel_section_id:
payload["tool_panel_section_id"] = tool_panel_section_id
create_response = operation(payload)
assert_status_code_is(create_response, 200)
return create_response.json()

def install_repository(
self, owner: str, name: str, changeset: str, tool_shed_url: str = DEFAULT_TOOL_SHED_URL
self,
owner: str,
name: str,
changeset: str,
tool_shed_url: str = DEFAULT_TOOL_SHED_URL,
tool_panel_section_id: Optional[str] = None,
) -> Dict[str, Any]:
try:
return self.repository_operation(
Expand All @@ -51,6 +64,7 @@ def install_repository(
name=name,
changeset=changeset,
tool_shed_url=tool_shed_url,
tool_panel_section_id=tool_panel_section_id,
)
except AssertionError as e:
if "Error attempting to retrieve installation information from tool shed" in unicodify(e):
Expand Down
34 changes: 34 additions & 0 deletions test/integration/test_panel_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import time

from galaxy_test.driver import integration_util
from galaxy_test.driver.uses_shed import UsesShed

THIS_DIR = os.path.dirname(__file__)
PANEL_VIEWS_DIR_1 = os.path.join(THIS_DIR, "panel_views_1")
Expand Down Expand Up @@ -123,6 +125,38 @@ def test_only_latest_version_in_panel(self):
assert tools[0]["version"] == "0.2"


class TestPanelViewsWithShedTools(integration_util.IntegrationTestCase, UsesShed):
framework_tool_and_types = True
allow_tool_conf_override = False

@classmethod
def handle_galaxy_config_kwds(cls, config):
super().handle_galaxy_config_kwds(config)
config["panel_views_dir"] = PANEL_VIEWS_DIR_1

def test_only_latest_version_in_panel_fastp(self):
FASTP_REPO = {"name": "fastp", "owner": "iuc", "tool_panel_section_id": "test_section_multi"}
OLD_CHANGESET = "1d8fe9bc4cb0"
NEW_CHANGESET = "dbf9c561ef29"
self.install_repository(**FASTP_REPO, changeset=OLD_CHANGESET)
self.install_repository(**FASTP_REPO, changeset=NEW_CHANGESET)

# give the toolbox a moment to reload after repo installation
time.sleep(5)
index = self.galaxy_interactor.get("tools", data=dict(in_panel=True, view="custom_13"))
index.raise_for_status()
index_as_list = index.json()
sections = [x for x in index_as_list if x["model_class"] == "ToolSection"]
assert len(sections) == 1
section = sections[0]
assert section["id"] == "test_section_multi"
tools = section["elems"]
assert len(tools) == 2, len(tools)
fastp = tools[0]
assert fastp["id"] == "toolshed.g2.bx.psu.edu/repos/iuc/fastp/fastp/0.20.1+galaxy0"
assert fastp["tool_shed_repository"]["changeset_revision"] == NEW_CHANGESET


class TestPanelViewsFromConfigIntegration(integration_util.IntegrationTestCase):
framework_tool_and_types = True

Expand Down

0 comments on commit ca5fce7

Please sign in to comment.