Skip to content

Commit

Permalink
Resolve jdbc deprecations in tests (apache#40436)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirrao authored and romsharon98 committed Jul 26, 2024
1 parent da667d7 commit c45097a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit c45097a

Please sign in to comment.