feluelle commented on a change in pull request #6232: [AIRFLOW-5582] AutoCommit 
in jdbc is missing get_autocommit
URL: https://github.com/apache/airflow/pull/6232#discussion_r344497572
 
 

 ##########
 File path: tests/contrib/hooks/test_jdbc_hook.py
 ##########
 @@ -49,6 +49,20 @@ def test_jdbc_conn_connection(self, jdbc_mock):
         self.assertIsInstance(jdbc_conn, Mock)
         self.assertEqual(jdbc_conn.name, jdbc_mock.return_value.name)  # 
pylint: disable=no-member
 
+    @patch("airflow.hooks.jdbc_hook.jaydebeapi.connect")
+    def test_jdbc_conn_set_autocommit(self, _):
+        jdbc_hook = JdbcHook()
+        jdbc_conn = jdbc_hook.get_conn()
+        jdbc_hook.set_autocommit(jdbc_conn, False)
+        jdbc_conn.jconn.setAutoCommit.assert_called_with(False)
+
+    @patch("airflow.hooks.jdbc_hook.jaydebeapi.connect")
+    def test_jdbc_conn_get_autocommit(self, _):
+        jdbc_hook = JdbcHook()
+        jdbc_conn = jdbc_hook.get_conn()
+        jdbc_hook.get_autocommit(jdbc_conn)
+        self.assertTrue(jdbc_conn.jconn.getAutoCommit.called)
 
 Review comment:
   ```suggestion
           jdbc_conn.jconn.getAutoCommit.assert_called_once_with()
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to