From bc0a10199b68b0738ac46b368a81daf4580e6e0c Mon Sep 17 00:00:00 2001 From: Prince Date: Thu, 23 May 2024 00:24:37 +0200 Subject: [PATCH 01/10] Spelling correction * Spelling correction --- src/jiraone/reporting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jiraone/reporting.py b/src/jiraone/reporting.py index d02b3b3..66fbfa7 100644 --- a/src/jiraone/reporting.py +++ b/src/jiraone/reporting.py @@ -536,7 +536,7 @@ def get_attachments_on_projects( :param attachment_file_name: Filename of the attachment list CSV to be written. - :param mode: Write mode for attachment list CVS to be written. By default it + :param mode: Write mode for attachment list CSV to be written. By default it is 'w', which means that any existing file will be overwritten. For example, set to 'a' if you want to append to instead of truncating any existing file. From 768a56ead340151505480a855f74fe63b9193b7e Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Thu, 23 May 2024 00:31:20 +0000 Subject: [PATCH 02/10] fix: docs/requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-6928867 --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 71399c3..40244f9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -7,3 +7,4 @@ numpy pandas matplotlib pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability +requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability From 400322552ac1a240d73c34228ae7e5d043679195 Mon Sep 17 00:00:00 2001 From: Prince Date: Thu, 23 May 2024 08:22:51 +0200 Subject: [PATCH 03/10] Change to issue project for test suites * Change to issue project for test suites --- test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test.py b/test.py index 387aaa8..27dc3b8 100644 --- a/test.py +++ b/test.py @@ -49,7 +49,9 @@ def setUp(self): self.token = os.environ.get("JIRAONEAPITOKEN") or "token" self.issue_key = "IP-5" self.issue_keys = "AT2-1" + self.key_issues = "IP-74" self.jql = "project = AT2 order by created desc" + self.queries = "project = IP order by created desc" def test_login_basic_auth(self): """Test the LOGIN authentication for basic auth""" @@ -318,7 +320,7 @@ def test_download_attachments(self): self.assertTrue(upload is True, "Cannot add attachment") # then download those attachments if __version__ >= "0.8.4": - PROJECT.get_attachments_on_projects(query=self.jql) + PROJECT.get_attachments_on_projects(query=self.queries) PROJECT.download_attachments( file_folder="Attachment", file_name="attachment_file.csv", @@ -346,7 +348,7 @@ def uploader(self) -> bool: """uploader function""" count = 0 check_upload = [] - for image in [self.issue_keys, self.issue_keys, self.issue_keys]: + for image in [self.key_issues, self.key_issues, self.key_issues]: issue_key = image # upload a public file for the test file_name = "test-attachment-{}".format(count) From b849a2b9c109d4a74b1c27cb9d126191ca697e0f Mon Sep 17 00:00:00 2001 From: Prince Date: Thu, 23 May 2024 08:51:22 +0200 Subject: [PATCH 04/10] Change the download test * Change the download test --- test.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test.py b/test.py index 27dc3b8..36a0708 100644 --- a/test.py +++ b/test.py @@ -330,18 +330,20 @@ def test_download_attachments(self): create_html_redirectors=True, ) # verify download - is_download = [] + download_count = 0 path = path_builder("Attachment", "attachment_file.csv") read_attachment = file_reader(file_name=path, skip=True) for attach_id in read_attachment: uri_attachment = attach_id[8].split("/")[-1] file_name = attach_id[6] - new_path = path_builder(f"Downloads/{uri_attachment}", f"{file_name}") + new_path = path_builder(f"Downloads/{uri_attachment}", file_name) if os.path.isfile(new_path): - is_download.append(True) + download_count += 1 else: - is_download.append(False) - self.assertTrue(all(is_download) is True, "Attachment download failed") + download_count -= 1 + self.assertTrue(download_count >= 3, "Attachment download failed") + delete_attachments(search=self.key_issues) + def uploader(self) -> bool: From 2389946aad33931bf5677a4081cf06cd99d87016 Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 01:21:39 +0200 Subject: [PATCH 05/10] Fix to sprint API #137 Fix to sprint API --- src/jiraone/access.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jiraone/access.py b/src/jiraone/access.py index 1d14c19..3f5e6a7 100644 --- a/src/jiraone/access.py +++ b/src/jiraone/access.py @@ -2930,12 +2930,14 @@ def get_all_sprints( :param max_results: defaults to 50 - :param query: A search term + :param query: A search term. Valid values e.g. future, active, or closed + Multiple can be separated by comma e.g. active,closed + :return: A string of the url """ if query is not None: - return "{}/rest/agile/1.0/board/{}/sprint?startAt={}&maxResults={}".format( + return "{}/rest/agile/1.0/board/{}/sprint?state={}&startAt={}&maxResults={}".format( LOGIN.base_url, board_id, query, start_at, max_results ) else: @@ -3909,12 +3911,12 @@ def project_validate(cls, key_or_name: str, check: str = None) -> str: @classmethod def runbackup(cls): """Runs a backup process for the environment - + Example 1:: # send a POST request with the payload payload_data = {"cbAttachments": "false", "exportToCloud": "true"} # changing "cbAttachments" to "true" will enable backup with attachments - + """ return "{}/rest/backup/1/export/runbackup".format(LOGIN.base_url) From 03a549bd98b5cee3c4e36d372d4de56f1bf8b10c Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 19:02:45 +0200 Subject: [PATCH 06/10] Black formatting applied --- src/jiraone/access.py | 334 +++++++++++++++--------------------------- 1 file changed, 115 insertions(+), 219 deletions(-) diff --git a/src/jiraone/access.py b/src/jiraone/access.py index 3f5e6a7..3da40dc 100644 --- a/src/jiraone/access.py +++ b/src/jiraone/access.py @@ -143,14 +143,10 @@ def oauth_session(self, oauth: dict) -> None: :return: None """ if not isinstance(oauth, dict): - add_log( - "Wrong data type received for " "the oauth argument.", "error" - ) + add_log("Wrong data type received for " "the oauth argument.", "error") raise JiraOneErrors( "wrong", - "Excepting a dictionary object got {} instead.".format( - type(oauth) - ), + "Excepting a dictionary object got {} instead.".format(type(oauth)), ) if ( "client_id" not in oauth @@ -158,8 +154,7 @@ def oauth_session(self, oauth: dict) -> None: or "callback_url" not in oauth ): add_log( - "You seem to be missing a key or " - "keys in your oauth argument.", + "You seem to be missing a key or " "keys in your oauth argument.", "debug", ) raise JiraOneErrors( @@ -189,17 +184,13 @@ def get_cloud_id(): for ids in cloud_id: if ids["name"] == oauth.get("name"): self.instance_name = ids["name"] - LOGIN.base_url = oauth_data.get("base_url").format( - cloud=ids["id"] - ) + LOGIN.base_url = oauth_data.get("base_url").format(cloud=ids["id"]) else: self.instance_name = cloud_id[0]["name"] LOGIN.base_url = oauth_data.get("base_url").format( cloud=cloud_id[0]["id"] ) - tokens.update( - {"base_url": LOGIN.base_url, "ins_name": self.instance_name} - ) + tokens.update({"base_url": LOGIN.base_url, "ins_name": self.instance_name}) if self.auth2_0: sess = json.loads(self.auth2_0) @@ -272,12 +263,8 @@ def validate_uri(uri) -> bool: "scope=", "scope=offline_access%20", 1 ) oauth.update({"callback_url": call_back}) - callback = oauth.get("callback_url").format( - YOUR_USER_BOUND_VALUE=state - ) - print( - "Please click or copy the link into your browser and hit Enter!" - ) + callback = oauth.get("callback_url").format(YOUR_USER_BOUND_VALUE=state) + print("Please click or copy the link into your browser and hit Enter!") print(callback) redirect_url = input("Enter the redirect url: \n") # Check if the supplied url is true to the one @@ -399,9 +386,7 @@ def token_session( extra = {"type": _type, "token": sess} self.__token_only_session__(extra) - def get( - self, url: str, *args, payload: dict = None, **kwargs - ) -> requests.Response: + def get(self, url: str, *args, payload: dict = None, **kwargs) -> requests.Response: """ A get request to HTTP request. @@ -452,9 +437,7 @@ def post( ) return response - def put( - self, url: str, *args, payload: dict = None, **kwargs - ) -> requests.Response: + def put(self, url: str, *args, payload: dict = None, **kwargs) -> requests.Response: """ A put request to HTTP request. @@ -599,9 +582,7 @@ def from_jira(obj: Any) -> Any: except Exception as err: raise JiraOneErrors( "wrong", - "An unknown exception has occurred " - "Other errors: " - f" {err}.", + "An unknown exception has occurred " "Other errors: " f" {err}.", ) from err @@ -734,9 +715,7 @@ def get_user_group(cls, account_id: str) -> str: ) @classmethod - def get_projects( - cls, *args: Any, start_at: int = 0, max_results: int = 50 - ) -> str: + def get_projects(cls, *args: Any, start_at: int = 0, max_results: int = 50) -> str: """Return a list of Projects available on an Instance How to use this endpoint ``/rest/api/3/project/search`` is mentioned `here @@ -776,21 +755,21 @@ def get_projects( if nos > 0: param = "&".join(args) print("Project Search Query Parameter:", param) - return "{}/rest/api/{}/project/search?{}&startAt={}&maxResults={}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - param, - start_at, - max_results, + return ( + "{}/rest/api/{}/project/search?{}&startAt={}&maxResults={}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + param, + start_at, + max_results, + ) ) else: - return ( - "{}/rest/api/{}/project/search?startAt={}&maxResults={}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - start_at, - max_results, - ) + return "{}/rest/api/{}/project/search?startAt={}&maxResults={}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + start_at, + max_results, ) @classmethod @@ -1063,12 +1042,14 @@ def search_all_notification_schemes( :return: A string of the url """ if query is not None: - return "{}/rest/api/{}/notificationscheme?{}&startAt={}&maxResults={}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - query, - start_at, - max_results, + return ( + "{}/rest/api/{}/notificationscheme?{}&startAt={}&maxResults={}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + query, + start_at, + max_results, + ) ) else: if attr is True: @@ -1151,13 +1132,11 @@ def get_field( LOGIN.base_url, "3" if LOGIN.api is True else "latest" ) else: - return ( - "{}/rest/api/{}/field/search?startAt={}&maxResults={}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - start_at, - max_results, - ) + return "{}/rest/api/{}/field/search?startAt={}&maxResults={}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + start_at, + max_results, ) @classmethod @@ -1224,22 +1203,14 @@ def issue_attachments( LOGIN.base_url, "3" if LOGIN.api is True else "latest", uri ) else: - if ( - query is not None - and attach_id is not None - and id_or_key is None - ): + if query is not None and attach_id is not None and id_or_key is None: return "{}/rest/api/{}/attachment/{}/{}".format( LOGIN.base_url, "3" if LOGIN.api is True else "latest", attach_id, query, ) - elif ( - query is not None - and attach_id is None - and id_or_key is not None - ): + elif query is not None and attach_id is None and id_or_key is not None: return "{}/rest/api/{}/issue/{}/{}".format( LOGIN.base_url, "3" if LOGIN.api is True else "latest", @@ -1276,9 +1247,7 @@ def search_issues_jql( ) @classmethod - def search_for_filters( - cls, query: Optional[str] = None, start_at: int = 0 - ) -> str: + def search_for_filters(cls, query: Optional[str] = None, start_at: int = 0) -> str: """Returns a paginated list of filters. Use this operation to get: * specific filters, by defining id only. @@ -1307,12 +1276,10 @@ def search_for_filters( start_at, ) else: - return ( - "{}/rest/api/{}/filter/search?startAt={}&maxResults=50".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - start_at, - ) + return "{}/rest/api/{}/filter/search?startAt={}&maxResults=50".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + start_at, ) @classmethod @@ -1539,12 +1506,10 @@ def get_project_component( ) else: if issue_count is True: - return ( - "{}/rest/api/{}/component/{}/relatedIssueCounts".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - ids, - ) + return "{}/rest/api/{}/component/{}/relatedIssueCounts".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + ids, ) else: return "{}/rest/api/{}/component/{}".format( @@ -1734,20 +1699,16 @@ def get_project_versions( else: if issue_count is True: - return ( - "{}/rest/api/{}/version/{}/relatedIssueCounts".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - ids, - ) + return "{}/rest/api/{}/version/{}/relatedIssueCounts".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + ids, ) elif unresolved_count is True: - return ( - "{}/rest/api/{}/version/{}/unresolvedIssueCount".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - ids, - ) + return "{}/rest/api/{}/version/{}/unresolvedIssueCount".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + ids, ) else: if swap is True: @@ -2055,9 +2016,7 @@ def work_logs( worklog_id: Optional[str] = ( kwargs.get("worklog_id") if "worklog_id" in kwargs else None ) - expand: Optional[str] = ( - kwargs.get("expand") if "expand" in kwargs else None - ) + expand: Optional[str] = kwargs.get("expand") if "expand" in kwargs else None notify_users: Optional[bool] = kwargs.get("notify_users", True) adjust_estimate: Optional[str] = kwargs.get("adjust_estimate", "auto") new_estimate: Optional[str] = ( @@ -2072,9 +2031,7 @@ def work_logs( reduce_by: Optional[str] = ( kwargs.get("reduce_by") if "reduce_by" in kwargs else None ) - since: Optional[int] = ( - kwargs.get("since") if "since" in kwargs else None - ) + since: Optional[int] = kwargs.get("since") if "since" in kwargs else None if key_or_id is not None and worklog_id is None: if started_after is not None and started_before is None: @@ -2286,14 +2243,11 @@ def work_logs( else: if since is not None and expand is not None: - return ( - "{}/rest/api/{}/worklog/updated?" - "expand={}&since={}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - expand, - since, - ) + return "{}/rest/api/{}/worklog/updated?" "expand={}&since={}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + expand, + since, ) elif since is not None and expand is None: return "{}/rest/api/{}/worklog/deleted?since={}".format( @@ -2310,9 +2264,7 @@ def work_logs( else: raise JiraOneErrors( "value", - "At least one argument " - "should be passed" - " with this method.", + "At least one argument " "should be passed" " with this method.", ) @classmethod @@ -2354,9 +2306,7 @@ def webhooks(cls, uri: Optional[str] = None) -> str: ) @classmethod - def task( - cls, task_id: Optional[str] = None, method: Optional[str] = "GET" - ) -> str: + def task(cls, task_id: Optional[str] = None, method: Optional[str] = "GET") -> str: """When a task has finished, this operation returns the JSON blob applicable to the task @@ -2589,11 +2539,7 @@ def project_avatar( raise JiraOneErrors( "value", f"{key} keyword argument is not a number." ) - if ( - "cord_x" in kwargs - and "size" in kwargs - and "cord_y" not in kwargs - ): + if "cord_x" in kwargs and "size" in kwargs and "cord_y" not in kwargs: return "{}/rest/api/{}/project/{}/avatar2?x={}&size={}".format( LOGIN.base_url, "3" if LOGIN.api is True else "latest", @@ -2601,11 +2547,7 @@ def project_avatar( kwargs.get("cord_x"), kwargs.get("size"), ) - elif ( - "cord_y" in kwargs - and "size" in kwargs - and "cord_x" not in kwargs - ): + elif "cord_y" in kwargs and "size" in kwargs and "cord_x" not in kwargs: return "{}/rest/api/{}/project/{}/avatar2?y={}&size={}".format( LOGIN.base_url, "3" if LOGIN.api is True else "latest", @@ -2640,9 +2582,7 @@ def project_avatar( key_or_id, ) else: - raise JiraOneErrors( - "wrong", "No such method exist within this operation" - ) + raise JiraOneErrors("wrong", "No such method exist within this operation") ################################################ # Jira Software Specifics API endpoints @@ -2686,9 +2626,7 @@ def move_issues_to_backlog_from_board(cls, board_id: int) -> str: :return: A string of the url """ - return "{}/rest/agile/1.0/backlog/{}/issue".format( - LOGIN.base_url, board_id - ) + return "{}/rest/agile/1.0/backlog/{}/issue".format(LOGIN.base_url, board_id) # BOARD -> API for Boards @@ -2730,10 +2668,8 @@ def get_board_by_filter_id( :return: A string of the url """ - return ( - "{}/rest/agile/1.0/board/filter/{}?startAt={}&maxResults={}".format( - LOGIN.base_url, filter_id, start_at, max_results - ) + return "{}/rest/agile/1.0/board/filter/{}?startAt={}&maxResults={}".format( + LOGIN.base_url, filter_id, start_at, max_results ) @classmethod @@ -2784,8 +2720,10 @@ def get_issues_on_backlog( :return: A string of the url """ if query is not None: - return "{}/rest/agile/1.0/board/{}/backlog?{}&startAt={}&maxResults={}".format( - LOGIN.base_url, board_id, query, start_at, max_results + return ( + "{}/rest/agile/1.0/board/{}/backlog?{}&startAt={}&maxResults={}".format( + LOGIN.base_url, board_id, query, start_at, max_results + ) ) else: return "{}/rest/agile/1.0/board/{}/backlog?startAt={}&maxResults={}".format( @@ -2824,8 +2762,10 @@ def get_issues_on_board( :return: A string of the url """ if query is not None: - return "{}/rest/agile/1.0/board/{}/issue?{}&startAt={}&maxResults={}".format( - LOGIN.base_url, board_id, query, start_at, max_results + return ( + "{}/rest/agile/1.0/board/{}/issue?{}&startAt={}&maxResults={}".format( + LOGIN.base_url, board_id, query, start_at, max_results + ) ) else: return "{}/rest/agile/1.0/board/{}/issue?startAt={}&maxResults={}".format( @@ -2852,9 +2792,7 @@ def move_issues_to_board(cls, board_id: int) -> str: :return: A string of the url """ - return "{}/rest/agile/1.0/board/{}/issue".format( - LOGIN.base_url, board_id - ) + return "{}/rest/agile/1.0/board/{}/issue".format(LOGIN.base_url, board_id) @classmethod def get_projects_on_board( @@ -2932,7 +2870,7 @@ def get_all_sprints( :param query: A search term. Valid values e.g. future, active, or closed Multiple can be separated by comma e.g. active,closed - + :return: A string of the url """ @@ -3059,10 +2997,8 @@ def get_organizations( LOGIN.base_url, account_id, start, limit ) else: - return ( - "{}/rest/servicedeskapi/organization?start={}&limit={}".format( - LOGIN.base_url, start, limit - ) + return "{}/rest/servicedeskapi/organization?start={}&limit={}".format( + LOGIN.base_url, start, limit ) @classmethod @@ -3090,9 +3026,7 @@ def get_organization(cls, org_id: int) -> str: :return: A string of the url """ - return "{}/rest/servicedeskapi/organization/{}".format( - LOGIN.base_url, org_id - ) + return "{}/rest/servicedeskapi/organization/{}".format(LOGIN.base_url, org_id) @classmethod def get_service_desks(cls, start: int = 0, limit: int = 100) -> str: @@ -3141,9 +3075,7 @@ def delete_organization(cls, org_id: int) -> str: :return: A string of the url """ - return "{}/rest/servicedeskapi/organization/{}".format( - LOGIN.base_url, org_id - ) + return "{}/rest/servicedeskapi/organization/{}".format(LOGIN.base_url, org_id) @classmethod def get_users_in_organization( @@ -3886,20 +3818,16 @@ def project_validate(cls, key_or_name: str, check: str = None) -> str: ) else: if check.lower() == "key": - return ( - "{}/rest/api/{}/projectvalidate/validProjectKey?{}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - f"key={key_or_name}", - ) + return "{}/rest/api/{}/projectvalidate/validProjectKey?{}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + f"key={key_or_name}", ) elif check.lower() == "name": - return ( - "{}/rest/api/{}/projectvalidate/validProjectName?{}".format( - LOGIN.base_url, - "3" if LOGIN.api is True else "latest", - f"name={key_or_name}", - ) + return "{}/rest/api/{}/projectvalidate/validProjectName?{}".format( + LOGIN.base_url, + "3" if LOGIN.api is True else "latest", + f"name={key_or_name}", ) else: raise JiraOneErrors( @@ -4079,18 +4007,16 @@ def search_field(find_field: str = None) -> Any: ) count_start_at = 0 while True: - load = LOGIN.get( - endpoint.get_field(query="type=custom", start_at=count_start_at) - ) if LOGIN.api is True else LOGIN.get( - endpoint.get_field(system="all") + load = ( + LOGIN.get( + endpoint.get_field(query="type=custom", start_at=count_start_at) + ) + if LOGIN.api is True + else LOGIN.get(endpoint.get_field(system="all")) ) if load.status_code < 300: - data = ( - load.json().get("values") - if LOGIN.api is True - else load.json() - ) + data = load.json().get("values") if LOGIN.api is True else load.json() break_out = count_start_at > ( load.json().get("total") if LOGIN.api is True else len(data) ) @@ -4138,8 +4064,7 @@ def get_field(find_field: str = None) -> Any: "key": value.get("key"), "searchable": value.get("searchable"), "type": value.get("schema").get("type"), - "system": value.get("schema").get( - "system"), + "system": value.get("schema").get("system"), } return { "name": value.get("name"), @@ -4300,9 +4225,7 @@ def separated(pull: Any = Any) -> Any: attr = {search["id"]: self.multi_field(concat)} payload = self.data_load(attr) LOGIN.put( - endpoint.issues( - issue_key_or_id=key_or_id, query=query - ), + endpoint.issues(issue_key_or_id=key_or_id, query=query), payload=payload, ) else: @@ -4322,29 +4245,19 @@ def separated(pull: Any = Any) -> Any: attr = { search["id"]: { "value": cass.__getitem__(1).lstrip(), - "child": { - "value": cass.__getitem__(3).lstrip() - }, + "child": {"value": cass.__getitem__(3).lstrip()}, } } payload = self.data_load(attr) response = LOGIN.put( - endpoint.issues( - issue_key_or_id=key_or_id, query=query - ), + endpoint.issues(issue_key_or_id=key_or_id, query=query), payload=payload, ) elif len(cass) <= 3: - attr = { - search["id"]: { - "value": cass.__getitem__(1).lstrip() - } - } + attr = {search["id"]: {"value": cass.__getitem__(1).lstrip()}} payload = self.data_load(attr) response = LOGIN.put( - endpoint.issues( - issue_key_or_id=key_or_id, query=query - ), + endpoint.issues(issue_key_or_id=key_or_id, query=query), payload=payload, ) elif search["customType"] in [ @@ -4365,9 +4278,7 @@ def separated(pull: Any = Any) -> Any: # or string for single value if options is None: if not isinstance(data, list): - raise JiraOneErrors( - "wrong", "Expecting a list of values" - ) + raise JiraOneErrors("wrong", "Expecting a list of values") else: if len(data) > 1: raise JiraOneErrors( @@ -4383,9 +4294,7 @@ def separated(pull: Any = Any) -> Any: options == "add" or options == "remove" ): # update the field with the desired value if not isinstance(data, list): - raise JiraOneErrors( - "wrong", "Expecting a list of values" - ) + raise JiraOneErrors("wrong", "Expecting a list of values") else: if len(data) == 1: attr = {search["id"]: [{options: data[0]}]} @@ -4427,17 +4336,13 @@ def separated(pull: Any = Any) -> Any: payload = self.data_load(attr) else: attr = { - search["id"]: self.multi_field( - data, s="accountId" - ) + search["id"]: self.multi_field(data, s="accountId") } payload = self.data_load(attr) elif options == "add" or options == "remove": # update the field with the desired value if not isinstance(data, list): - raise JiraOneErrors( - "wrong", "Excepting a list value" - ) + raise JiraOneErrors("wrong", "Excepting a list value") else: if search["type"] == "user": raise JiraOneErrors( @@ -4507,9 +4412,7 @@ def separated(pull: Any = Any) -> Any: " by comma.", ) else: - attr = { - search["id"]: self.multi_field(data, s="name") - } + attr = {search["id"]: self.multi_field(data, s="name")} payload = self.data_load(attr) elif options == "add" or options == "remove": # update the field with the desired value @@ -4526,15 +4429,11 @@ def separated(pull: Any = Any) -> Any: else: concat = ",".join(get_data) attr = { - search["id"]: self.multi_field( - concat, s="name" - ) + search["id"]: self.multi_field(concat, s="name") } payload = self.data_load(attr) LOGIN.put( - endpoint.issues( - issue_key_or_id=key_or_id, query=query - ), + endpoint.issues(issue_key_or_id=key_or_id, query=query), payload=payload, ) @@ -4594,8 +4493,7 @@ def separated(pull: Any = Any) -> Any: payload = self.data_load(attr) else: raise JiraOneErrors( - "wrong" - "You cannot post multiple values with these fields." + "wrong" "You cannot post multiple values with these fields." ) response = ( LOGIN.put( @@ -4789,9 +4687,7 @@ def get_field_value(self, name: str, keys: Union[str, int]) -> Any: get_value = LOGIN.get(endpoint.issues(keys)).json() try: if "errorMessages" in get_value: - return "It seems you don't have access to this issue {}".format( - keys - ) + return "It seems you don't have access to this issue {}".format(keys) return get_value["fields"][var.get("id")] except (AttributeError, KeyError) as i: if isinstance(i, AttributeError): From eefb127b3f84a1a4766db2ef6ed643f33c35abf4 Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 19:08:41 +0200 Subject: [PATCH 07/10] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 58cb63f..9ced901 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "jiraone" -version = "v0.8.4" +version = "v0.8.5" authors = [ { name="Prince Nyeche", email="support@elfapp.website" }, ] From ca3d2808514a68a80afb9526bb37397b73a6fe9c Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 19:09:00 +0200 Subject: [PATCH 08/10] Update SECURITY.md --- SECURITY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SECURITY.md b/SECURITY.md index d8a5941..c5dd8d4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,6 +6,7 @@ Below is the list of supported versions for the jiraone library | Version | Supported | |---------|--------------------| +| 0.8.5 | :white_check_mark: | | 0.8.4 | :white_check_mark: | | 0.8.3 | :white_check_mark: | | 0.8.2 | :white_check_mark: | From 180106c4379674f2842c4d54092d08a03ba5fd4f Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 19:12:08 +0200 Subject: [PATCH 09/10] Version update to CHANGES.md --- CHANGES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 9c9a423..47a6939 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,14 @@ # Jira one change log +**Release 0.8.5** - 2024-06-26 +Fixes: +- 🐛 `get_all_sprints` API fix to query parameter #137 +- 🐛 Corrected errors associated with the test script + +Updates: +- Made some spelling corrections + + **Release 0.8.4** - 2024-05-20 Thanks to [@huyz](https://github.com/huyz) for the below fixes and improvements to v0.8.4 From 6d2be886ff6e5a7b46f253b75d0a88c0e1b63b66 Mon Sep 17 00:00:00 2001 From: Prince Date: Wed, 26 Jun 2024 19:12:36 +0200 Subject: [PATCH 10/10] Version updates to CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 47a6939..64fa57c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ # Jira one change log **Release 0.8.5** - 2024-06-26 + Fixes: - 🐛 `get_all_sprints` API fix to query parameter #137 - 🐛 Corrected errors associated with the test script