Skip to content

Commit 0fd3d12

Browse files
Bump atlassian-python-api from 3.41.21 to 4.0.3 (#1125)
* Bump atlassian-python-api from 3.41.21 to 4.0.3 Bumps [atlassian-python-api](https://github.com/atlassian-api/atlassian-python-api) from 3.41.21 to 4.0.3. - [Release notes](https://github.com/atlassian-api/atlassian-python-api/releases) - [Commits](atlassian-api/atlassian-python-api@3.41.21...4.0.3) --- updated-dependencies: - dependency-name: atlassian-python-api dependency-version: 4.0.3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Please mypy * Deterministic queryparam order --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mathieu Leplatre <[email protected]>
1 parent 621552e commit 0fd3d12

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

jbi/jira/client.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Collection, Iterable, Optional
2+
from typing import Any, Collection, Iterable, Optional, Union
33

44
import requests
55
from atlassian import Jira
@@ -84,7 +84,7 @@ def paginated_projects(
8484
expand=None,
8585
url=None,
8686
keys: Optional[Collection[str]] = None,
87-
):
87+
) -> dict:
8888
"""Returns a paginated list of projects visible to the user.
8989
9090
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-projects/#api-rest-api-2-project-search-get
@@ -97,20 +97,23 @@ def paginated_projects(
9797
"``projects_from_cloud`` method is only available for Jira Cloud platform"
9898
)
9999

100-
params = []
100+
params_dict: dict[str, Any] = {}
101101

102102
if keys is not None:
103103
if len(keys) > 50:
104104
raise ValueError("Up to 50 project keys can be provided.")
105-
params = [("keys", key) for key in keys]
105+
params_dict["keys"] = list(keys)
106106

107107
if included_archived:
108-
params.append(("includeArchived", included_archived))
108+
params_dict["includeArchived"] = included_archived
109109
if expand:
110-
params.append(("expand", expand))
110+
params_dict["expand"] = expand
111111
page_url = url or self.resource_url("project/search")
112112
is_url_absolute = bool(page_url.lower().startswith("http"))
113-
return self.get(page_url, params=params, absolute=is_url_absolute)
113+
projects: Union[dict, None] = self.get(
114+
page_url, params=params_dict, absolute=is_url_absolute
115+
)
116+
return projects if projects else {"values": []}
114117

115118
@instrumented_method
116119
def permitted_projects(self, permissions: Optional[Iterable] = None) -> list[dict]:
@@ -125,5 +128,5 @@ def permitted_projects(self, permissions: Optional[Iterable] = None) -> list[dic
125128
"/rest/api/2/permissions/project",
126129
json={"permissions": list(permissions)},
127130
)
128-
projects: list[dict] = response["projects"]
131+
projects: list[dict] = response["projects"] if response else []
129132
return projects

jbi/jira/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def check_jira_all_project_issue_types_exist(self, actions):
519519

520520
try:
521521
paginated_project_response = self.client.paginated_projects(
522-
expand="issueTypes", keys=actions.configured_jira_projects_keys
522+
expand="issueTypes", keys=sorted(actions.configured_jira_projects_keys)
523523
)
524524
except requests.RequestException:
525525
return [

poetry.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ python = ">=3.12, <3.14"
1010
fastapi = "^0.115.12"
1111
pydantic = {version = "^2.11.3", extras = ["email"]}
1212
uvicorn = {extras = ["standard"], version = "^0.34.2"}
13-
atlassian-python-api = "^3.41.21"
13+
atlassian-python-api = "^4.0.3"
1414
dockerflow = {extras = ["fastapi"], version = "2024.4.2"}
1515
Jinja2 = "^3.1.6"
1616
sentry-sdk = {extras = ["fastapi"], version = "^2.27.0"}

tests/unit/jira/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_paginated_projects_with_keys(settings, jira_client, mocked_responses):
8686
responses.GET,
8787
url,
8888
status=200,
89-
match=[responses.matchers.query_string_matcher("keys=ABC&keys=DEF")],
89+
match=[responses.matchers.query_string_matcher("keys=['ABC', 'DEF']")],
9090
json=mocked_response_data,
9191
)
9292
resp = jira_client.paginated_projects(keys=["ABC", "DEF"])

tests/unit/jira/test_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ def test_all_project_issue_types_exist(
422422
status=200,
423423
match=[
424424
responses.matchers.query_string_matcher(
425-
"keys=ABC&keys=DEF&expand=issueTypes"
426-
)
425+
"keys=['ABC', 'DEF']&expand=issueTypes"
426+
),
427427
],
428428
json={"values": project_data},
429429
)

0 commit comments

Comments
 (0)