Skip to content

Commit

Permalink
Merge branch 'release_23.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Dec 7, 2023
2 parents f129d90 + 8072dc8 commit 2f74a84
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 47 deletions.
8 changes: 4 additions & 4 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6410,7 +6410,7 @@ export interface components {
*/
ItemTagsCreatePayload: {
/** value of the item tag */
value: string;
value?: string;
};
/**
* ItemTagsListResponse
Expand Down Expand Up @@ -13814,7 +13814,7 @@ export interface operations {
history_id: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
Expand Down Expand Up @@ -15121,7 +15121,7 @@ export interface operations {
tag_name: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
Expand Down Expand Up @@ -20014,7 +20014,7 @@ export interface operations {
tag_name: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/schema/item_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ItemTagsListResponse(Model):
class ItemTagsCreatePayload(Model):
"""Payload schema for creating an item tag."""

value: str = Field(
Required,
value: Optional[str] = Field(
None,
title="value of the item tag",
)
11 changes: 10 additions & 1 deletion lib/galaxy/tool_util/parser/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _parse_test(i, test_dict) -> ToolSourceTest:
return test_dict


def __to_test_assert_list(assertions) -> AssertionList:
def to_test_assert_list(assertions) -> AssertionList:
def expand_dict_form(item):
key, value = item
new_value = value.copy()
Expand All @@ -281,6 +281,12 @@ def expand_dict_form(item):
for assertion in assertions:
# TODO: not handling nested assertions correctly,
# not sure these are used though.
if "that" not in assertion:
new_assertion = {}
for assertion_key, assertion_value in assertion.items():
new_assertion["that"] = assertion_key
new_assertion.update(assertion_value)
assertion = new_assertion
children = []
if "children" in assertion:
children = assertion["children"]
Expand All @@ -295,6 +301,9 @@ def expand_dict_form(item):
return assert_list or None # XML variant is None if no assertions made


__to_test_assert_list = to_test_assert_list


class YamlPageSource(PageSource):
def __init__(self, inputs_list):
self.inputs_list = inputs_list
Expand Down
41 changes: 28 additions & 13 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -7322,24 +7322,39 @@ and ``contains``. In addition there is ``sim_size`` which is discouraged in favo
<xs:annotation>
<xs:documentation xml:lang="en">Documentation for PermissiveBoolean</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
<xs:enumeration value="True"/>
<xs:enumeration value="False"/>
<xs:enumeration value="yes"/>
<xs:enumeration value="no"/>
</xs:restriction>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
<xs:enumeration value="True"/>
<xs:enumeration value="False"/>
<xs:enumeration value="yes"/>
<xs:enumeration value="no"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="Bytes">
<xs:annotation>
<xs:documentation xml:lang="en">Number of bytes allowing for suffix (k|K|M|G|P|E)i? </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="(0|[1-9][0-9]*)([kKMGTPE]i?)?"></xs:pattern>
</xs:restriction>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:integer">
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="(0|[1-9][0-9]*)([kKMGTPE]i?)?"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:complexType name="EdamTopics">
<xs:annotation>
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/webapps/galaxy/api/item_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def create(
trans: ProvidesAppContext = DependsOnTrans,
item_id: DecodedDatabaseIdField = Path(..., title="Item ID", alias=tagged_item_id),
tag_name: str = Path(..., title="Tag Name"),
payload: ItemTagsCreatePayload = Body(...),
payload: ItemTagsCreatePayload = Body(None),
) -> ItemTagsResponse:
if payload is None:
payload = ItemTagsCreatePayload()
return self.manager.create(trans, tagged_item_class, item_id, tag_name, payload)

@router.put(
Expand Down
59 changes: 33 additions & 26 deletions lib/galaxy_test/api/test_item_tags.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from typing import (
Any,
Dict,
)

from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
Expand All @@ -6,7 +11,7 @@
from galaxy_test.driver import integration_util


class TestHistoriesApi(integration_util.IntegrationTestCase):
class TestItemTagsApi(integration_util.IntegrationTestCase):
dataset_populator: DatasetPopulator

@classmethod
Expand All @@ -20,75 +25,77 @@ def setUp(self):
self.dataset_collection_populator = DatasetCollectionPopulator(self.galaxy_interactor)

def test_get_tags_workflows(self):
response = self._test_get_tags(self._create_prefixes()["workflows"])
response = self._test_get_tags(self._create_prefix("workflows"))
self._assert_status_code_is(response, 200)

def test_create_tag_workflows(self):
response = self._test_create_tag(self._create_prefixes()["workflows"])
response = self._test_create_tag(self._create_prefix("workflows"))
self._assert_status_code_is(response, 200)

def test_update_tag_workflows(self):
response = self._test_update_tag(self._create_prefixes()["workflows"])
response = self._test_update_tag(self._create_prefix("workflows"))
self._assert_status_code_is(response, 200)

def test_get_tag_workflows(self):
response = self._test_get_tag(self._create_prefixes()["workflows"])
response = self._test_get_tag(self._create_prefix("workflows"))
self._assert_status_code_is(response, 200)

def test_delete_tag_workflows(self):
response = self._test_delete_tag(self._create_prefixes()["workflows"])
response = self._test_delete_tag(self._create_prefix("workflows"))
self._assert_status_code_is(response, 200)

def test_get_tags_histories(self):
response = self._test_get_tags(self._create_prefixes()["histories"])
response = self._test_get_tags(self._create_prefix("histories"))
self._assert_status_code_is(response, 200)

def test_create_tag_histories(self):
response = self._test_create_tag(self._create_prefixes()["histories"])
response = self._test_create_tag(self._create_prefix("histories"))
self._assert_status_code_is(response, 200)

def test_update_tag_histories(self):
response = self._test_update_tag(self._create_prefixes()["histories"])
response = self._test_update_tag(self._create_prefix("histories"))
self._assert_status_code_is(response, 200)

def test_get_tag_histories(self):
response = self._test_get_tag(self._create_prefixes()["histories"])
response = self._test_get_tag(self._create_prefix("histories"))
self._assert_status_code_is(response, 200)

def test_delete_tag_histories(self):
response = self._test_delete_tag(self._create_prefixes()["histories"])
response = self._test_delete_tag(self._create_prefix("histories"))
self._assert_status_code_is(response, 200)

def test_get_tags_histories_content(self):
response = self._test_get_tags(self._create_prefixes()["histories_content"])
response = self._test_get_tags(self._create_prefix("histories_content"))
self._assert_status_code_is(response, 200)

def test_create_tag_histories_content(self):
response = self._test_create_tag(self._create_prefixes()["histories_content"])
response = self._test_create_tag(self._create_prefix("histories_content"))
self._assert_status_code_is(response, 200)

def test_update_tag_histories_content(self):
response = self._test_update_tag(self._create_prefixes()["histories_content"])
response = self._test_update_tag(self._create_prefix("histories_content"))
self._assert_status_code_is(response, 200)

def test_get_tag_histories_content(self):
response = self._test_get_tag(self._create_prefixes()["histories_content"])
response = self._test_get_tag(self._create_prefix("histories_content"))
self._assert_status_code_is(response, 200)

def test_delete_tag_histories_content(self):
response = self._test_delete_tag(self._create_prefixes()["histories_content"])
response = self._test_delete_tag(self._create_prefix("histories_content"))
self._assert_status_code_is(response, 200)

def _create_prefixes(self):
workflow_id = self._create_workflow()
def _create_prefix(self, type_: str) -> str:
if type_ == "workflows":
workflow_id = self._create_workflow()
return f"workflows/{workflow_id}"
history_id = self._create_history()
history_content_id = self._create_history_contents(history_id)
prefixs = {
"workflows": f"workflows/{workflow_id}",
"histories": f"histories/{history_id}",
"histories_content": f"histories/{history_id}/contents/{history_content_id}",
}
return prefixs
if type_ == "histories":
return f"histories/{history_id}"
elif type_ == "histories_content":
history_content_id = self._create_history_contents(history_id)
return f"histories/{history_id}/contents/{history_content_id}"
else:
raise ValueError(f"Unrecognized type_ {type_}")

def _test_get_tags(self, prefix):
url = f"{prefix}/tags"
Expand Down Expand Up @@ -123,7 +130,7 @@ def _test_delete_tag(self, prefix):

def _create_valid_tag(self, prefix: str):
url = f"{prefix}/tags/awesometagname"
tag_data = dict(value="awesometagvalue")
tag_data: Dict[str, Any] = {} # Can also be dict(value="awesometagvalue")
response = self._post(url, data=tag_data, json=True)
return response

Expand Down
40 changes: 40 additions & 0 deletions test/unit/tool_util/test_test_parsing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import yaml

from galaxy.tool_util.parser.yaml import to_test_assert_list

# Legacy style
ASSERT_THAT_LIST = yaml.safe_load(
"""
- that: "has_text"
text: "Number of input reads |\t1051466"
- that: "has_text"
text: "Uniquely mapped reads number |\t871202"
"""
)
# New list of assertion style
ASSERT_LIST = yaml.safe_load(
"""
- has_text:
text: "Number of input reads |\t1051466"
- has_text:
text: "Uniquely mapped reads number |\t871202"
"""
)
# Singleton assertion
SIMPLE_ASSERT = {"has_text": {"text": "Number of input reads |\t1051466"}}


def test_assert_that_list_to_test_assert_list():
to_test_assert_list(ASSERT_THAT_LIST)


def test_assert_list_to_test_assert_list():
to_test_assert_list(ASSERT_LIST)


def test_simple_assert_to_test_assert_list():
to_test_assert_list(SIMPLE_ASSERT)


def test_assert_legacy_same_as_new_list_style():
assert to_test_assert_list(ASSERT_THAT_LIST) == to_test_assert_list(ASSERT_THAT_LIST)

0 comments on commit 2f74a84

Please sign in to comment.