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/10/31 13:52:45 UTC

[GitHub] [airflow] feluelle commented on a change in pull request #6467: [AIRFLOW-5814] Implementing Presto hook tests

feluelle commented on a change in pull request #6467: [AIRFLOW-5814] Implementing Presto hook tests
URL: https://github.com/apache/airflow/pull/6467#discussion_r341146121
 
 

 ##########
 File path: tests/hooks/test_presto_hook.py
 ##########
 @@ -51,3 +51,39 @@ def test_insert_rows(self, mock_insert_rows):
         target_fields = None
         self.db_hook.insert_rows(table, rows, target_fields)
         mock_insert_rows.assert_called_once_with(table, rows, None, 0)
+
+    def test_get_first_record(self):
+        statement = 'SQL'
+        result_sets = [('row1',), ('row2',)]
+        self.cur.fetchone.return_value = result_sets[0]
+
+        self.assertEqual(result_sets[0], self.db_hook.get_first(statement))
+        assert self.conn.close.call_count == 1
+        assert self.cur.close.call_count == 1
 
 Review comment:
   ```suggestion
           self.cur.close.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:
users@infra.apache.org


With regards,
Apache Git Services