blcksrx commented on issue #6467: [AIRFLOW-5814] Implementing Presto hook tests
URL: https://github.com/apache/airflow/pull/6467#issuecomment-549030052
 
 
   Actually, because of this implementation, I can't test **get_connection**. 
now I have two solutions for it:
   1.  change the **setUp** method and also change other methods related to 
changing
   2. do exactly the same as **test_postgres_hook** and create another class 
for test connections.
   
   @feluelle 
   ```
   def setUp(self):
           super().setUp()
   
           self.cur = mock.MagicMock()
           self.conn = mock.MagicMock()
           self.conn.cursor.return_value = self.cur
           conn = self.conn
   
           class UnitTestPrestoHook(PrestoHook):
               conn_name_attr = 'test_conn_id'
   
               def get_conn(self):
                   return conn
   
           self.db_hook = UnitTestPrestoHook()
   ```

----------------------------------------------------------------
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