You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/04/07 21:00:26 UTC

[GitHub] [airflow] Fokko commented on a change in pull request #5057: [AIRFLOW-4257] Remove the global session from the core test

Fokko commented on a change in pull request #5057: [AIRFLOW-4257] Remove the global session from the core test
URL: https://github.com/apache/airflow/pull/5057#discussion_r272851815
 
 

 ##########
 File path: tests/core.py
 ##########
 @@ -1563,30 +1555,30 @@ def test_cli_connections_add_delete(self):
         ])
 
         # Prepare to add connections
-        session = settings.Session()
         extra = {'new1': None,
                  'new2': None,
                  'new3': "{'extra': 'yes'}",
                  'new4': "{'extra': 'yes'}"}
 
-        # Add connections
-        for index in range(1, 6):
-            conn_id = 'new%s' % index
-            result = (session
-                      .query(Connection)
-                      .filter(Connection.conn_id == conn_id)
-                      .first())
-            result = (result.conn_id, result.conn_type, result.host,
-                      result.port, result.get_extra())
-            if conn_id in ['new1', 'new2', 'new3', 'new4']:
-                self.assertEqual(result, (conn_id, 'postgres', 'host', 5432,
-                                          extra[conn_id]))
-            elif conn_id == 'new5':
-                self.assertEqual(result, (conn_id, 'hive_metastore', 'host',
-                                          9083, None))
-            elif conn_id == 'new6':
-                self.assertEqual(result, (conn_id, 'google_cloud_platform',
-                                          None, None, "{'extra': 'yes'}"))
+        with create_session as session:
 
 Review comment:
   Good catch!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services