Rebase into handling multiple versions.

This commit is contained in:
John Chilton
2020-11-11 22:21:27 -05:00
parent be2f25c8b8
commit ab142bf9c5
2 changed files with 9 additions and 3 deletions
+7 -3
View File
@@ -519,9 +519,13 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
rval.append(lineage_tool)
if not rval:
# still no tool, do a deeper search and try to match by old ids
for tool in self._tools_by_id.values():
if tool.old_id == tool_id:
rval.append(tool)
if get_all_versions and tool_id in self._tool_versions_by_id:
rval.extend(self._tool_versions_by_id[tool_id].values())
else:
for tool in self._tools_by_id.values():
if tool.old_id == tool_id:
rval.append(tool)
# if we don't have a lineage_map for this tool we need to sort by version,
# so that the last tool in rval is the newest tool.
rval.sort(key=lambda t: t.version)
+2
View File
@@ -690,11 +690,13 @@ class ToolsTestCase(ApiTestCase, TestsTools):
@uses_test_history(require_new=False)
def test_test_by_versions(self, history_id):
test_data_response = self._get("tools/%s/test_data" % "multiple_versions")
test_data_response.raise_for_status()
test_data_dicts = test_data_response.json()
assert len(test_data_dicts) == 1
assert test_data_dicts[0]["tool_version"] == "0.2"
test_data_response = self._get("tools/%s/test_data?tool_version=*" % "multiple_versions")
test_data_response.raise_for_status()
test_data_dicts = test_data_response.json()
assert len(test_data_dicts) == 2