Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions atlassian/jira/jira_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def enhanced_jql(
limit: Optional[int] = None,
expand: Optional[str] = None,
):
"""Search Jira Cloud issues through the v3 enhanced JQL endpoint.
"""Search Jira Cloud issues through the enhanced JQL endpoint of ``api_version``.

Use ``nextPageToken`` from a previous response to retrieve the next
page. Unlike the older search API, enhanced JQL is cursor-paginated.
Expand All @@ -60,7 +60,7 @@ def enhanced_jql(
params["fields"] = ",".join(fields) if isinstance(fields, (list, tuple, set)) else fields
if expand is not None:
params["expand"] = expand
return self.get(self.endpoint("search/jql", api_version=3), params=params)
return self.get(self.endpoint("search/jql"), params=params)

def enhanced_jql_get_list_of_tickets(
self,
Expand Down
4 changes: 2 additions & 2 deletions docs/jira_cloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Enhanced JQL search
-------------------

Both ``JiraCloud`` and the legacy ``Jira(..., cloud=True)`` client provide
``enhanced_jql()``. The method always uses Jira Cloud's v3
``/search/jql`` endpoint, regardless of the Core client's selected version.
``enhanced_jql()``. ``JiraCloud`` uses the ``/search/jql`` endpoint of its
``api_version`` (3 by default). The legacy client always uses the v3 endpoint.
Pass the returned ``nextPageToken`` to fetch another page, or use
``enhanced_jql_get_list_of_tickets()`` to collect cursor-paginated results.

Expand Down
9 changes: 7 additions & 2 deletions tests/test_jira_cloud_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_core_methods_honor_the_selected_v2_route(self):
jira.get_issue("ABC-1")
get.assert_called_once_with("rest/api/2/issue/ABC-1", params=None, data=None)

def test_core_client_supports_enhanced_jql_at_v3(self):
def test_core_client_enhanced_jql_uses_the_configured_api_version(self):
jira = JiraCloud("https://example.atlassian.net", api_version=2)

with patch.object(jira, "get", return_value={"issues": [], "isLast": True}) as get:
Expand All @@ -95,7 +95,7 @@ def test_core_client_supports_enhanced_jql_at_v3(self):
)

get.assert_called_once_with(
"rest/api/3/search/jql",
"rest/api/2/search/jql",
params={
"jql": "project = EXAMPLE ORDER BY key DESC",
"fields": "summary,description",
Expand All @@ -105,6 +105,11 @@ def test_core_client_supports_enhanced_jql_at_v3(self):
},
)

default = JiraCloud("https://example.atlassian.net")
with patch.object(default, "get", return_value={"issues": [], "isLast": True}) as get:
default.enhanced_jql("project = EXAMPLE")
get.assert_called_once_with("rest/api/3/search/jql", params={"jql": "project = EXAMPLE", "fields": "*all"})

def test_core_client_enhanced_jql_collects_cursor_pages(self):
jira = JiraCloud("https://example.atlassian.net")

Expand Down
Loading