From ca5fce75669b7f5a6b360459d7aa8a2c02e88f3d Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 16 Nov 2023 10:56:17 +0100 Subject: [PATCH] Test tool shed version as well --- lib/galaxy_test/base/uses_shed_api.py | 18 ++++++++++++-- test/integration/test_panel_views.py | 34 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lib/galaxy_test/base/uses_shed_api.py b/lib/galaxy_test/base/uses_shed_api.py index 3b8da66f37a..58a2c74522a 100644 --- a/lib/galaxy_test/base/uses_shed_api.py +++ b/lib/galaxy_test/base/uses_shed_api.py @@ -34,15 +34,28 @@ class UsesShedApi: ) 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( @@ -51,6 +64,7 @@ class UsesShedApi: 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): diff --git a/test/integration/test_panel_views.py b/test/integration/test_panel_views.py index 8da009a7f53..5f8b3f5507b 100644 --- a/test/integration/test_panel_views.py +++ b/test/integration/test_panel_views.py @@ -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") @@ -123,6 +125,38 @@ class TestPanelViewsFromDirectoryIntegration(integration_util.IntegrationTestCas 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