Skip to content

Commit 2ff352d

Browse files
committed
Fix tests
1 parent 05d2939 commit 2ff352d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tests/e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_search_tags(self):
135135
self.assertEqual(tags[0]["name"], "testSearchTag")
136136
self.assertEqual(tags[0]["description"], "testDesc")
137137

138-
tags = self.api.search_tags(name="desc")
138+
tags = self.api.search_tags("", description="Desc")
139139
self.assertEqual(len(tags), 1)
140140
self.assertEqual(tags[0]["name"], "testSearchTag")
141141
self.assertEqual(tags[0]["description"], "testDesc")

yeti/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,20 +757,25 @@ def new_tag(self, name: str, description: str | None = None) -> dict[str, Any]:
757757
)
758758
return json.loads(response)
759759

760-
def search_tags(self, name: str, count: int = 100, page: int = 0):
760+
def search_tags(
761+
self, name: str, description: str = "", count: int = 100, page: int = 0
762+
):
761763
"""Searches for tags in Yeti.
762764
763765
Returns tag information based on a substring match of the tag name.
764766
765767
Args:
766768
name: The name of the tag to search for (substring match).
769+
description: An optional description to filter tags by (substring match).
767770
count: The number of results to return (default is 100).
768771
page: The page of results to return (default is 0, which means the first page).
769772
770773
Returns:
771774
The response from the API; a list of dicts representing tags.
772775
"""
773776
params = {"name": name, "count": count, "page": page}
777+
if description:
778+
params["description"] = description
774779
response = self.do_request(
775780
"POST", f"{self._url_root}/api/v2/tags/search", json_data=params
776781
)

0 commit comments

Comments
 (0)