Skip to content
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

Resolve jdbc deprecations in tests #40436

Merged
merged 1 commit into from
Jun 26, 2024
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
2 changes: 0 additions & 2 deletions tests/deprecations_ignore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@
- tests/providers/google/cloud/transfers/test_gcs_to_gcs.py::TestGoogleCloudStorageToCloudStorageOperator::test_wc_with_last_modified_time_with_all_true_cond
- tests/providers/google/cloud/transfers/test_gcs_to_gcs.py::TestGoogleCloudStorageToCloudStorageOperator::test_wc_with_last_modified_time_with_one_true_cond
- tests/providers/google/cloud/transfers/test_gcs_to_gcs.py::TestGoogleCloudStorageToCloudStorageOperator::test_wc_with_no_last_modified_time
- tests/providers/jdbc/operators/test_jdbc.py::TestJdbcOperator::test_execute_do_push
- tests/providers/jdbc/operators/test_jdbc.py::TestJdbcOperator::test_execute_dont_push
- tests/providers/microsoft/azure/hooks/test_adx.py::TestAzureDataExplorerHook::test_backcompat_prefix_works
- tests/providers/microsoft/mssql/operators/test_mssql.py::TestMsSqlOperator::test_get_hook_default
- tests/providers/microsoft/mssql/operators/test_mssql.py::TestMsSqlOperator::test_get_hook_from_conn
Expand Down
8 changes: 5 additions & 3 deletions tests/providers/jdbc/operators/test_jdbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
from unittest.mock import patch

from airflow.providers.common.sql.hooks.sql import fetch_all_handler
from airflow.providers.jdbc.operators.jdbc import JdbcOperator
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator

JDBC_DEFAULT = "jdbc_default"


class TestJdbcOperator:
Expand All @@ -29,7 +31,7 @@ def setup_method(self):

@patch("airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator.get_db_hook")
def test_execute_do_push(self, mock_get_db_hook):
jdbc_operator = JdbcOperator(**self.kwargs, do_xcom_push=True)
jdbc_operator = SQLExecuteQueryOperator(**self.kwargs, do_xcom_push=True, conn_id=JDBC_DEFAULT)
jdbc_operator.execute(context={})

mock_get_db_hook.return_value.run.assert_called_once_with(
Expand All @@ -42,7 +44,7 @@ def test_execute_do_push(self, mock_get_db_hook):

@patch("airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator.get_db_hook")
def test_execute_dont_push(self, mock_get_db_hook):
jdbc_operator = JdbcOperator(**self.kwargs, do_xcom_push=False)
jdbc_operator = SQLExecuteQueryOperator(**self.kwargs, do_xcom_push=False, conn_id=JDBC_DEFAULT)
jdbc_operator.execute(context={})

mock_get_db_hook.return_value.run.assert_called_once_with(
Expand Down