feluelle commented on a change in pull request #6467: [AIRFLOW-5814]
Implementing Presto hook tests
URL: https://github.com/apache/airflow/pull/6467#discussion_r341144676
##########
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
+ self.cur.execute.assert_called_once_with(statement)
+
+ def test_get_records(self):
+ statement = 'SQL'
+ result_sets = [('row1',), ('row2',)]
+ self.cur.fetchall.return_value = result_sets
+
+ self.assertEqual(result_sets, self.db_hook.get_records(statement))
+ assert self.conn.close.call_count == 1
+ assert self.cur.close.call_count == 1
+ self.cur.execute.assert_called_once_with(statement)
+ print(1)
Review comment:
Please remove this print statement ;)
----------------------------------------------------------------
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