potiuk commented on a change in pull request #4938: [AIRFLOW-4117] 
Multi-staging Image - Travis CI tests [Step 3/3]
URL: https://github.com/apache/airflow/pull/4938#discussion_r300239427
 
 

 ##########
 File path: tests/contrib/hooks/test_sftp_hook.py
 ##########
 @@ -25,14 +25,29 @@
 
 from airflow.contrib.hooks.sftp_hook import SFTPHook
 from airflow.models import Connection
+from airflow.utils.db import provide_session
 
 TMP_PATH = '/tmp'
 TMP_DIR_FOR_TESTS = 'tests_sftp_hook_dir'
 TMP_FILE_FOR_TESTS = 'test_file.txt'
 
+SFTP_CONNECTION_USER = "root"
+
 
 class SFTPHookTest(unittest.TestCase):
+
+    @provide_session
+    def update_connection(self, login, session=None):
+        connection = (session.query(Connection).
+                      filter(Connection.conn_id == "sftp_default")
+                      .first())
+        old_login = connection.login
+        connection.login = login
+        session.commit()
+        return old_login
 
 Review comment:
   Hey @ashb - can you please confirm you are ok with it ?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to