Files
galaxy/test/integration/test_workflow_invocation.py
T
Nicola Soranzo c35d8f2a06 Replace `unittest.TestCase` with pytest-based partial re-implementation
Also:
- Rename `FooBarTestCase` test classes as `TestFooBar`. These were collected
  by pytest only because they were `unittest.TestCase` derived, but normally
  pytest collects only test classes whose name starts with `Test`, see
  https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-python_classes
2022-09-27 03:34:58 +01:00

56 lines
2.3 KiB
Python

"""Integration tests for workflow syncing."""
from galaxy_test.base.populators import (
DatasetPopulator,
WorkflowPopulator,
)
from galaxy_test.base.uses_shed_api import UsesShedApi
from galaxy_test.driver import integration_util
class TestWorkflowInvocation(integration_util.IntegrationTestCase, UsesShedApi):
dataset_populator: DatasetPopulator
framework_tool_and_types = True
require_admin_user = False
def setUp(self):
super().setUp()
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
self.workflow_populator = WorkflowPopulator(self.galaxy_interactor)
def test_run_workflow_with_missing_tool(self):
self.install_repository("iuc", "compose_text_param", "feb3acba1e0a") # 0.1.0
with self.dataset_populator.test_history() as history_id:
workflow_id = self.workflow_populator.upload_yaml_workflow(
"""
class: GalaxyWorkflow
steps:
nonexistent:
tool_id: nonexistent_tool
tool_version: "0.1"
label: nonexistent
compose_text_param:
tool_id: compose_text_param
tool_version: "0.0.1"
label: compose_text_param
"""
)
# should fail and return both tool ids since version 0.0.1 of compose_text_param does not exist
invocation_response = self.workflow_populator.invoke_workflow(
workflow_id, history_id=history_id, request={"require_exact_tool_versions": True}
)
self._assert_status_code_is(invocation_response, 400)
assert (
invocation_response.json().get("err_msg")
== "Workflow was not invoked; the following required tools are not installed: nonexistent_tool (version 0.1), compose_text_param (version 0.0.1)"
)
# should fail but return only the tool_id of non_existent tool as another version of compose_text_param is installed
invocation_response = self.workflow_populator.invoke_workflow(
workflow_id, history_id=history_id, request={"require_exact_tool_versions": False}
)
self._assert_status_code_is(invocation_response, 400)
assert (
invocation_response.json().get("err_msg")
== "Workflow was not invoked; the following required tools are not installed: nonexistent_tool"
)