Skip to content

Bump atlassian-python-api from 3.41.21 to 4.0.3 #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2025
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
19 changes: 11 additions & 8 deletions jbi/jira/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from typing import Collection, Iterable, Optional
from typing import Any, Collection, Iterable, Optional, Union

import requests
from atlassian import Jira
Expand Down Expand Up @@ -84,7 +84,7 @@ def paginated_projects(
expand=None,
url=None,
keys: Optional[Collection[str]] = None,
):
) -> dict:
"""Returns a paginated list of projects visible to the user.

https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-projects/#api-rest-api-2-project-search-get
Expand All @@ -97,20 +97,23 @@ def paginated_projects(
"``projects_from_cloud`` method is only available for Jira Cloud platform"
)

params = []
params_dict: dict[str, Any] = {}

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

if included_archived:
params.append(("includeArchived", included_archived))
params_dict["includeArchived"] = included_archived
if expand:
params.append(("expand", expand))
params_dict["expand"] = expand
page_url = url or self.resource_url("project/search")
is_url_absolute = bool(page_url.lower().startswith("http"))
return self.get(page_url, params=params, absolute=is_url_absolute)
projects: Union[dict, None] = self.get(
page_url, params=params_dict, absolute=is_url_absolute
)
return projects if projects else {"values": []}

@instrumented_method
def permitted_projects(self, permissions: Optional[Iterable] = None) -> list[dict]:
Expand All @@ -125,5 +128,5 @@ def permitted_projects(self, permissions: Optional[Iterable] = None) -> list[dic
"/rest/api/2/permissions/project",
json={"permissions": list(permissions)},
)
projects: list[dict] = response["projects"]
projects: list[dict] = response["projects"] if response else []
return projects
2 changes: 1 addition & 1 deletion jbi/jira/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def check_jira_all_project_issue_types_exist(self, actions):

try:
paginated_project_response = self.client.paginated_projects(
expand="issueTypes", keys=actions.configured_jira_projects_keys
expand="issueTypes", keys=sorted(actions.configured_jira_projects_keys)
)
except requests.RequestException:
return [
Expand Down
9 changes: 5 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python = ">=3.12, <3.14"
fastapi = "^0.115.12"
pydantic = {version = "^2.11.3", extras = ["email"]}
uvicorn = {extras = ["standard"], version = "^0.34.2"}
atlassian-python-api = "^3.41.21"
atlassian-python-api = "^4.0.3"
dockerflow = {extras = ["fastapi"], version = "2024.4.2"}
Jinja2 = "^3.1.6"
sentry-sdk = {extras = ["fastapi"], version = "^2.27.0"}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/jira/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_paginated_projects_with_keys(settings, jira_client, mocked_responses):
responses.GET,
url,
status=200,
match=[responses.matchers.query_string_matcher("keys=ABC&keys=DEF")],
match=[responses.matchers.query_string_matcher("keys=['ABC', 'DEF']")],
json=mocked_response_data,
)
resp = jira_client.paginated_projects(keys=["ABC", "DEF"])
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/jira/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ def test_all_project_issue_types_exist(
status=200,
match=[
responses.matchers.query_string_matcher(
"keys=ABC&keys=DEF&expand=issueTypes"
)
"keys=['ABC', 'DEF']&expand=issueTypes"
),
],
json={"values": project_data},
)
Expand Down
Loading