mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Merge pull request #21916 from jmchilton/dbkey_unset
Fix dbkey filter returning no options when dbkey unset
This commit is contained in:
@@ -220,10 +220,10 @@ class DataMetaFilter(Filter):
|
||||
ref = _get_ref_data(other_values, self.ref_name)
|
||||
except KeyError: # no such dataset
|
||||
log.warning(f"could not filter by metadata: {self.ref_name} unknown")
|
||||
return []
|
||||
return copy.deepcopy(options)
|
||||
except ValueError: # not a valid dataset
|
||||
log.warning(f"could not filter by metadata: {self.ref_name} not a data or collection parameter")
|
||||
return []
|
||||
return copy.deepcopy(options)
|
||||
# get the metadata value.
|
||||
# - for lists: (of data sets) and collections the meta data values of all
|
||||
# elements is determined
|
||||
|
||||
@@ -60,11 +60,11 @@ def populate_model(request_context, inputs, state_inputs, group_inputs: list[dic
|
||||
tool_dict["default_value"] = input.value_to_basic(initial_value, request_context.app, use_security=True)
|
||||
tool_dict["text_value"] = input.value_to_display_text(tool_dict["value"])
|
||||
except ImplicitConversionRequired:
|
||||
tool_dict = input.to_dict(request_context)
|
||||
tool_dict = input.to_dict(request_context, other_values=other_values)
|
||||
# This hack leads client to display a text field
|
||||
tool_dict["textable"] = True
|
||||
except Exception:
|
||||
tool_dict = input.to_dict(request_context)
|
||||
tool_dict = input.to_dict(request_context, other_values=other_values)
|
||||
log.exception("tools::to_json() - Skipping parameter expansion '%s'", input.name)
|
||||
if input_index >= len(group_inputs):
|
||||
group_inputs.append(tool_dict)
|
||||
|
||||
@@ -72,6 +72,10 @@ class TestsTools:
|
||||
hdca_id = create_response.json()["outputs"][0]["id"]
|
||||
return hdca_id
|
||||
|
||||
def _get_build_option_values(self, build, input_name):
|
||||
matching = [i for i in build["inputs"] if i["name"] == input_name][0]
|
||||
return [o[1] for o in matching["options"]]
|
||||
|
||||
def _run_cat(self, history_id, inputs, assert_ok=False, **kwargs):
|
||||
return self._run("cat", history_id, inputs, assert_ok=assert_ok, **kwargs)
|
||||
|
||||
@@ -261,6 +265,28 @@ class TestToolsApi(ApiTestCase, TestsTools):
|
||||
assert galaxy_url.startswith("http")
|
||||
assert galaxy_url.endswith("tool_runner?tool_id=ratmine")
|
||||
|
||||
@skip_without_tool("dbkey_filter_input")
|
||||
def test_build_request_dbkey_filter_set(self):
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
hda = self.dataset_populator.new_dataset(history_id, content="test", dbkey="hg19", wait=True)
|
||||
inputs = {"inputs": {"src": "hda", "id": hda["id"]}}
|
||||
build = self.dataset_populator.build_tool_state("dbkey_filter_input", history_id, inputs=inputs)
|
||||
option_values = self._get_build_option_values(build, "index")
|
||||
assert "hg19_value" in option_values
|
||||
assert "hg18_value" not in option_values
|
||||
|
||||
@skip_without_tool("dbkey_filter_input")
|
||||
def test_build_request_dbkey_filter_unset(self):
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
hda = self.dataset_populator.new_dataset(history_id, content="test", wait=True)
|
||||
inputs = {"inputs": {"src": "hda", "id": hda["id"]}}
|
||||
build = self.dataset_populator.build_tool_state("dbkey_filter_input", history_id, inputs=inputs)
|
||||
option_values = self._get_build_option_values(build, "index")
|
||||
# with no dbkey set, all options from test_fasta_indexes should be available
|
||||
assert "hg19_value" in option_values
|
||||
assert "hg18_value" in option_values
|
||||
assert "mm10_value" in option_values
|
||||
|
||||
@skip_without_tool("cheetah_problem_unbound_var_input")
|
||||
def test_legacy_biotools_xref_injection(self):
|
||||
url = self._api_url("tools/cheetah_problem_unbound_var_input")
|
||||
|
||||
@@ -1218,8 +1218,12 @@ class BaseDatasetPopulator(BasePopulator):
|
||||
kwds["credentials_context"] = json.dumps(kwds["credentials_context"])
|
||||
return dict(tool_id=tool_id, inputs=json.dumps(inputs), history_id=history_id, **kwds)
|
||||
|
||||
def build_tool_state(self, tool_id: str, history_id: str):
|
||||
response = self._post(f"tools/{tool_id}/build?history_id={history_id}")
|
||||
def build_tool_state(self, tool_id: str, history_id: str, inputs: Optional[dict] = None):
|
||||
if inputs is not None:
|
||||
payload = {"history_id": history_id, "inputs": inputs}
|
||||
response = self._post(f"tools/{tool_id}/build", data=payload, json=True)
|
||||
else:
|
||||
response = self._post(f"tools/{tool_id}/build?history_id={history_id}")
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user