From cf1eaa8d3658c4c229cfa5e99172cedae81de5f1 Mon Sep 17 00:00:00 2001 From: jason810496 Date: Wed, 4 Dec 2024 19:47:07 +0800 Subject: [PATCH] Remove Provider Deprecations in Atlassian Jira --- .../providers/atlassian/jira/CHANGELOG.rst | 8 +++++ .../providers/atlassian/jira/hooks/jira.py | 15 +-------- .../tests/atlassian/jira/hooks/test_jira.py | 32 ------------------- 3 files changed, 9 insertions(+), 46 deletions(-) diff --git a/providers/src/airflow/providers/atlassian/jira/CHANGELOG.rst b/providers/src/airflow/providers/atlassian/jira/CHANGELOG.rst index 54c66ebf9e7fb..20586fa51ba9c 100644 --- a/providers/src/airflow/providers/atlassian/jira/CHANGELOG.rst +++ b/providers/src/airflow/providers/atlassian/jira/CHANGELOG.rst @@ -27,6 +27,14 @@ Changelog --------- +.. warning:: + All deprecated classes, parameters and features have been removed from the Atlassian Jira provider package. + The following breaking changes were introduced: + + * Hooks + + * Removed the use of the ``verify`` extra parameters as a ``str`` from ``JiraHook``. Use ``verify`` extra parameters as a ``bool`` instead. + 2.7.1 ..... diff --git a/providers/src/airflow/providers/atlassian/jira/hooks/jira.py b/providers/src/airflow/providers/atlassian/jira/hooks/jira.py index b4f3a207f0313..7ebe60fb82844 100644 --- a/providers/src/airflow/providers/atlassian/jira/hooks/jira.py +++ b/providers/src/airflow/providers/atlassian/jira/hooks/jira.py @@ -19,12 +19,11 @@ from __future__ import annotations -import warnings from typing import Any from atlassian import Jira -from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning +from airflow.exceptions import AirflowException from airflow.hooks.base import BaseHook @@ -62,18 +61,6 @@ def get_conn(self) -> Jira: # only required attributes are taken for now, # more can be added ex: timeout, cloud, session - # verify - if isinstance(verify, str): - warnings.warn( - "Extra parameter `verify` using str is deprecated and will be removed " - "in a future release. Please use `verify` using bool instead.", - AirflowProviderDeprecationWarning, - stacklevel=2, - ) - verify = True - if extra_options["verify"].lower() == "false": - verify = False - self.client = Jira( url=conn.host, username=conn.login, diff --git a/providers/tests/atlassian/jira/hooks/test_jira.py b/providers/tests/atlassian/jira/hooks/test_jira.py index d90a91400f973..215fadddd93f8 100644 --- a/providers/tests/atlassian/jira/hooks/test_jira.py +++ b/providers/tests/atlassian/jira/hooks/test_jira.py @@ -21,7 +21,6 @@ import pytest -from airflow.exceptions import AirflowProviderDeprecationWarning from airflow.models import Connection from airflow.providers.atlassian.jira.hooks.jira import JiraHook @@ -39,7 +38,6 @@ class TestJiraHook: @pytest.fixture(autouse=True) def setup_test_cases(self, monkeypatch): self.conn_id = "jira_default" - self.conn_id_with_str_verify = "jira_default_with_str" self.host = "https://localhost/jira/" self.port = 443 self.login = "user" @@ -60,20 +58,6 @@ def setup_test_cases(self, monkeypatch): ) ), ) - monkeypatch.setenv( - f"AIRFLOW_CONN_{self.conn_id_with_str_verify}".upper(), - connection_as_json( - Connection( - conn_id=self.conn_id_with_str_verify, - conn_type="jira", - host="https://localhost/jira/", - port=443, - login="user", - password="password", - extra='{"verify": "False", "project": "AIRFLOW"}', - ) - ), - ) def test_jira_client_connection(self, mocked_jira_client): jira_hook = JiraHook(proxies=self.proxies) @@ -87,19 +71,3 @@ def test_jira_client_connection(self, mocked_jira_client): ) assert isinstance(jira_hook.client, mock.Mock) assert jira_hook.client.name == mocked_jira_client.return_value.name - - def test_jira_client_connection_with_str(self, mocked_jira_client): - warning_message = "Extra parameter `verify` using str is deprecated and will be removed" - - with pytest.warns(AirflowProviderDeprecationWarning, match=warning_message): - jira_hook = JiraHook(jira_conn_id=self.conn_id_with_str_verify, proxies=self.proxies) - - mocked_jira_client.assert_called_once_with( - url=self.host, - username=self.login, - password=self.password, - verify_ssl=False, - proxies=self.proxies, - ) - assert isinstance(jira_hook.client, mock.Mock) - assert jira_hook.client.name == mocked_jira_client.return_value.name